Skip to content

Commit

Permalink
Merge pull request #1974 from TomzxForks/fixes/1972-update-docs-getHe…
Browse files Browse the repository at this point in the history
…ader-returns-array

Fix documentation using the getHeader method
  • Loading branch information
sagikazarmark committed Feb 5, 2018
2 parents aa5b807 + b9bf901 commit 6a7e4e8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ together in a single report:
$response = $client->request('GET', $initialRequest); // Make your request
// Retrieve both Redirect History headers
$redirectUriHistory = $response->getHeader('X-Guzzle-Redirect-History'); // retrieve Redirect URI history
$redirectCodeHistory = $response->getHeader('X-Guzzle-Redirect-Status-History'); // retrieve Redirect HTTP Status history
$redirectUriHistory = $response->getHeader('X-Guzzle-Redirect-History')[0]; // retrieve Redirect URI history
$redirectCodeHistory = $response->getHeader('X-Guzzle-Redirect-Status-History')[0]; // retrieve Redirect HTTP Status history
// Add the initial URI requested to the (beginning of) URI history
array_unshift($redirectUriHistory, $initialRequest);
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ trivial to integrate with web services.
]);
echo $res->getStatusCode();
// "200"
echo $res->getHeader('content-type');
echo $res->getHeader('content-type')[0];
// 'application/json; charset=utf8'
echo $res->getBody();
// {"type":"User"...'
Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ You can retrieve headers from the response:
}
// Get a header from the response.
echo $response->getHeader('Content-Length');
echo $response->getHeader('Content-Length')[0];
// Get all of the response headers.
foreach ($response->getHeaders() as $name => $values) {
Expand Down

0 comments on commit 6a7e4e8

Please sign in to comment.