educoder/pest — pull request #45 by commandtab (2013-07-03 20:07:54+00:00)
Title: Allow associative header arrays for all methods

This pull request allows users to specify an associative array of headers for any HTTP method (in addition to the existing numerically indexed format). For example, given two arrays, one numerically indexed and the other associative, the following Pest calls will now perform the same HTTP GET:

```php
$headers_numeric = array(
'X-Random-Header: ExampleValue',
'X-Awesome-Header: AwesomeValue'
);
$headers_assoc = array(
'X-Random-Header' => 'ExampleValue',
'X-Awesome-Header' => 'AwesomeValue'
);

$pest = new Pest('http://educoder.github.io');
$pest->get('/blog/', false, $headers_numeric);
$pest->get('/blog/', false, $headers_assoc);
```

Prior to this pull request, the latter `get()` would be performed, but the headers would be silently discarded. It took me a little while to figure out why, and I thought I'd write this improvement so that either header array format will work as the user expects.