We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently the response is a plain string like this:
X-Script: worker.php Content-type: text/html; charset=UTF-8 Hello World
For a better usage provide the response as an immutable object with the following interface:
<?php declare(strict_types=1); interface ProvidesResponseData { public function getRequestId() : int; public function getHeaders() : array; public function getHeader( string $headerKey ) : string; public function getBody() : string; public function getRawResponse() : string; public function getDuration() : float; }
So headers and body as well as the raw response can be accessed separately.
For the example response above the usage would look like this:
<?php declare(strict_types=1); $response = $client->sendRequest($params, $content); echo $response->getRequestId(); /* prints: 1234 */ print_r($response->getHeaders()); /* prints: Array ( ['X-Custom'] => 'Header' ['Content-Type'] => 'text/plain; charset=UTF-8' ) */ echo $response->getHeader('X-Custom'); /* prints: Header */ echo $response->getHeader('Content-Type'); /* prints: text/plain; charset=UTF-8 */ echo $response->getBody(); /* prints: Hello World */ echo $response->getRawResponse(); /* prints: X-Script: worker.php Content-type: text/html; charset=UTF-8 Hello World */ echo $response->getDuration(); /* prints: 0.54829836 */
The text was updated successfully, but these errors were encountered:
@sandrokeil
Sorry, something went wrong.
Provides the response as an object, #2
a9044a1
6b24663
Bumping release v1.1.0, closes #2, closes #5
bc50d8e
b97cd49
hollodotme
No branches or pull requests
Currently the response is a plain string like this:
For a better usage provide the response as an immutable object with the following interface:
So headers and body as well as the raw response can be accessed separately.
For the example response above the usage would look like this:
The text was updated successfully, but these errors were encountered: