petdance/test-www-mechanize — pull request #36 by ezarko (2014-12-19 17:58:45+00:00)
Title: Proposal to add header_exists and header_matches.

Andy,

Someone sent me a link to https://github.com/commando/dogpatch, and it seemed to me that adding header_exists and header_matches to Test::WWW::Mechanize (and therefore child classes like Test::WWW:Mechanize::JSON) would be a good improvement. This is a first pass, may need some adjustments, and definitely could use some better docs as well as any tests. It just seemed easier to describe the feature request by throwing up something.

Here is an example that corresponds to the first one in dogpatch:
```
use Test::More tests => 5;
use Test::WWW::Mechanize::JSON;

my $mech = Test::WWW::Mechanize::JSON->new;

$mech->get("https://api.github.com");
ok( $mech->success );
$mech->header_exists("X-GitHub-Request-Id");
$mech->header_exists("ETag");
$mech->header_matches("Server", "GitHub.com");
$mech->json_ok or BAIL_OUT Dumper $mech->response;
```

Regards,
-Eric