From: des Date: Mon, 13 Aug 2007 18:36:15 +0000 (+0000) Subject: Fix assert_xid() and add assert_no_xid() (useful for piped requests) X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b912b751b06bbbbe6e80e4210af5b85fc21663d;p=varnish Fix assert_xid() and add assert_no_xid() (useful for piped requests) git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1841 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-tools/regress/lib/Varnish/Test/Case.pm b/varnish-tools/regress/lib/Varnish/Test/Case.pm index 2b50fd92..a39bbf34 100644 --- a/varnish-tools/regress/lib/Varnish/Test/Case.pm +++ b/varnish-tools/regress/lib/Varnish/Test/Case.pm @@ -313,11 +313,21 @@ sub assert_xid($;$) { unless defined($resp); die "No X-Varnish header\n" - unless (!$resp->header('X-Varnish')); + unless (defined($resp->header('X-Varnish'))); die "Invalid X-Varnish header\n" unless ($resp->header('X-Varnish') =~ m/^\d+(?: \d+)?$/); } +sub assert_no_xid($;$) { + my ($self, $resp) = @_; + + $resp = $self->{'cached_response'} + unless defined($resp); + + die "X-Varnish header present where none expected\n" + if (defined($resp->header('X-Varnish'))); +} + sub assert_cached($;$) { my ($self, $resp) = @_;