Skip to content

Commit c3188e7

Browse files
author
Martin Brecht-Precht
committed
Updated readme.
1 parent ec550e8 commit c3188e7

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ $request->addAuthentication($clientCertificateAuthentication);
308308
If using the `BasicHttpClient` the response object is returned by the termination methods listed above. If directly using the Request instance, you can get the Response object via a getter.
309309

310310
```{php}
311+
// Getting the response BasicHttpClient\Response\ResponseInterface implementing object
311312
$response = $request->getResponse();
312313
313314
// Reading the HTTP status code as integer; will return `200`
@@ -327,7 +328,21 @@ echo print_r($response->getBody(), true).PHP_EOL;
327328

328329
## Getting effective Request information
329330

330-
TODO
331+
After successful performing the request, the effective request information is tracked back to the Request object. They can get accessed as follows.
332+
333+
```{php}
334+
// Getting the effective endpoint URL including the query parameters
335+
echo print_r($request->getEffectiveEndpoint(), true) . PHP_EOL;
336+
337+
// Getting the effective HTTP status, f.e. `POST /?paramName1=paramValue1&paramName2=paramValue2&paramName3=1&paramName4=42 HTTP/1.1`
338+
echo print_r($request->getEffectiveStatus(), true) . PHP_EOL;
339+
340+
// Getting the effective raw request headers as string
341+
echo print_r($request->getEffectiveRawHeader(), true) . PHP_EOL;
342+
343+
// Getting the effective request headers as array of `BasicHttpClient\Request\Message\Header\Header` objects
344+
echo print_r($request->getEffectiveHeaders(), true) . PHP_EOL.PHP_EOL;
345+
```
331346

332347
---
333348

detaild.php

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,23 @@
6767
->perform();
6868

6969
$response = $request->getResponse();
70-
echo print_r($response->getStatusCode(), true).PHP_EOL;
71-
echo print_r($response->getStatusText(), true).PHP_EOL;
72-
echo print_r($response->getHeaders(), true).PHP_EOL;
73-
echo print_r($response->getBody(), true).PHP_EOL;
70+
echo print_r($response->getStatusCode(), true) . PHP_EOL;
71+
echo print_r($response->getStatusText(), true) . PHP_EOL;
72+
echo print_r($response->getHeaders(), true) . PHP_EOL;
73+
echo print_r($response->getBody(), true) . PHP_EOL . PHP_EOL;
7474

7575
$statistics = $response->getStatistics();
76-
echo print_r($statistics->getRedirectEndpoint(), true).PHP_EOL;
77-
echo print_r($statistics->getRedirectCount(), true).PHP_EOL;
78-
echo print_r($statistics->getRedirectTime(), true).PHP_EOL;
76+
echo print_r($statistics->getRedirectEndpoint(), true) . PHP_EOL;
77+
echo print_r($statistics->getRedirectCount(), true) . PHP_EOL;
78+
echo print_r($statistics->getRedirectTime(), true) . PHP_EOL;
79+
echo print_r($statistics->getConnectionEstablishTime(), true) . PHP_EOL;
80+
echo print_r($statistics->getHostLookupTime(), true) . PHP_EOL;
81+
echo print_r($statistics->getPreTransferTime(), true) . PHP_EOL;
82+
echo print_r($statistics->getStartTransferTime(), true) . PHP_EOL;
83+
echo print_r($statistics->getTotalTime(), true) . PHP_EOL . PHP_EOL;
84+
85+
echo print_r($request->getEffectiveEndpoint(), true) . PHP_EOL;
86+
echo print_r($request->getEffectiveStatus(), true) . PHP_EOL;
87+
echo print_r($request->getEffectiveRawHeader(), true) . PHP_EOL;
88+
echo print_r($request->getEffectiveHeaders(), true) . PHP_EOL.PHP_EOL;
7989

80-
echo print_r($statistics->getConnectionEstablishTime(), true).PHP_EOL;
81-
echo print_r($statistics->getHostLookupTime(), true).PHP_EOL;
82-
echo print_r($statistics->getPreTransferTime(), true).PHP_EOL;
83-
echo print_r($statistics->getStartTransferTime(), true).PHP_EOL;
84-
echo print_r($statistics->getTotalTime(), true).PHP_EOL;

0 commit comments

Comments
 (0)