Permalink
Browse files

Fix duplicate headers in response

  • Loading branch information...
1 parent bea970d commit 9162ec1df98faac82f4a9d067a6bbcc792cee9f5 @gbarr committed Feb 22, 2012
Showing with 6 additions and 1 deletion.
  1. +1 −0 Changes.txt
  2. +1 −1 lib/LWP/Protocol/AnyEvent/http.pm
  3. +4 −0 t/04_error_404.t
View
@@ -2,6 +2,7 @@ Revision history for LWP-Protocol-AnyEvent-http
1.0.4 2012-mm-dd
- Preserve AnyEvent::HTTP pseudo heads by prefixing with X-AE-
+ - Fix duplicate headers in response
1.0.3 2011-06-17
- Skip tests that will fail due to DNS hijacking.
@@ -38,7 +38,7 @@ sub _set_response_headers {
];
}
- $response->push_header(%headers);
+ $response->header(%headers);
}
View
@@ -35,10 +35,14 @@ my $chunk_count = 0;
my $res = $client->get("${url}error/notfound/foo", ":content_cb" => sub {
$chunk_count++
});
+
+my $date_count = () = $res->headers->as_string =~ m!^(Date:)!mig;
+
ok !$res->is_success, "The request was not successfull, as planned";
is $res->code, 404, "We caught the remote error (404)";
is $res->content, '', "We got an empty response";
is $chunk_count, 0, "We received no chunks either";
+is $date_count, 1, "Only 1 Date header in response";
undef $t; # stop the timer

0 comments on commit 9162ec1

Please sign in to comment.