]> err.no Git - varnish/commitdiff
Fix assert_xid() and add assert_no_xid() (useful for piped requests)
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 13 Aug 2007 18:36:15 +0000 (18:36 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 13 Aug 2007 18:36:15 +0000 (18:36 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1841 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-tools/regress/lib/Varnish/Test/Case.pm

index 2b50fd9253d3004721abb2dcc9bdcf7e4a1e2ffc..a39bbf34411b6ce65adbe2c6e19eb7de393914fd 100644 (file)
@@ -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) = @_;