From: des Date: Mon, 13 Aug 2007 18:30:15 +0000 (+0000) Subject: Not all responses have XIDs. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83f9a386464406a4a65aacc7b9e7d77a963520cc;p=varnish Not all responses have XIDs. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1839 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 e5dfe651..2b50fd92 100644 --- a/varnish-tools/regress/lib/Varnish/Test/Case.pm +++ b/varnish-tools/regress/lib/Varnish/Test/Case.pm @@ -264,10 +264,6 @@ sub request($$$$;$$) { if $ev eq 'ev_client_timeout'; die "Internal error\n" unless $resp && ref($resp) && $resp->isa('HTTP::Response'); - die "No X-Varnish header\n" - unless (!$resp->header('X-Varnish')); - die "Invalid X-Varnish header\n" - unless ($resp->header('X-Varnish') =~ m/^\d+(?: \d+)?$/); $resp->request($req); return $self->{'cached_response'} = $resp; } @@ -310,6 +306,18 @@ sub assert_ok($;$) { $self->assert_code(200, $resp); } +sub assert_xid($;$) { + my ($self, $resp) = @_; + + $resp = $self->{'cached_response'} + unless defined($resp); + + die "No X-Varnish header\n" + unless (!$resp->header('X-Varnish')); + die "Invalid X-Varnish header\n" + unless ($resp->header('X-Varnish') =~ m/^\d+(?: \d+)?$/); +} + sub assert_cached($;$) { my ($self, $resp) = @_;