@@ -107,14 +107,14 @@ Request Headers
107107
108108Headers can be passed via the header set methods.
109109
110- Below we see an example using string and a constant of the Header class:
110+ Below we see an example using string and a constant of the RequestHeader class:
111111
112112.. code-block :: php
113113
114- use Framework\HTTP\Header ;
114+ use Framework\HTTP\RequestHeader ;
115115
116116 $request->setHeader('Content-Type', 'application/json'); // static
117- $request->setHeader(Header ::CONTENT_TYPE, 'application/json'); // static
117+ $request->setHeader(RequestHeader ::CONTENT_TYPE, 'application/json'); // static
118118
119119 To set the Content-Type it is possible to use a method for this:
120120
@@ -180,7 +180,7 @@ Cookies can be set by the ``setCookie`` method:
180180 Post Forms
181181##########
182182
183- To send data to a form you can set an array with the fields and values using the
183+ To send data as a form you can set an array with fields and values using the
184184``setPost `` method:
185185
186186.. code-block :: php
@@ -257,7 +257,7 @@ if it fails:
257257 $response = $client->run($request); // Framework\HTTP\Client\Response
258258
259259 If you call the Request's ``setGetInfo `` method, it will be possible to obtain
260- information from curl through the exception's ``getInfo `` method:
260+ information from Curl through the exception's ``getInfo `` method:
261261
262262.. code-block :: php
263263
@@ -267,7 +267,7 @@ information from curl through the exception's ``getInfo`` method:
267267 $response = $client->run($request); // Framework\HTTP\Client\Response
268268 } catch (Framework\HTTP\Client\RequestException $exception) {
269269 echo $exception->getMessage(); // string
270- var_dump($exception->getInfo(); // array
270+ var_dump($exception->getInfo()) ; // array
271271 }
272272
273273 Asynchronous Requests
@@ -284,18 +284,21 @@ Responses will be delivered as requests are finalized:
284284
285285.. code-block :: php
286286
287+ use Framework\HTTP\Client\Client;
287288 use Framework\HTTP\Client\Request;
288289 use Framework\HTTP\Client\ResponseError;
289290
291+ $client = new Client();
292+
290293 $requests = [
291294 1 => new Request('https://aplus-framework.com'),
292295 2 => new Request('https://aplus-framework.tld'),
293296 ];
294297
295298 foreach($client->runMulti($requests) as $id => $response) {
296299 if ($response instanceof ResponseError) {
297- echo "Request $id has error:";
298- echo '- ' . $response->getError() . '<br >';
300+ echo "Request $id has error: ";
301+ echo $response->getError() . '. <br >';
299302 continue;
300303 }
301304 echo "Request $id responded:";
@@ -348,10 +351,10 @@ Or, get the headers individually:
348351
349352.. code-block :: php
350353
351- use Framework\HTTP\Header ;
354+ use Framework\HTTP\ResponseHeader ;
352355
353356 $response->getHeader('Content-Type'); // string or null
354- $response->getHeader(Header ::CONTENT_TYPE); // string or null
357+ $response->getHeader(ResponseHeader ::CONTENT_TYPE); // string or null
355358
356359 Response Body
357360#############
@@ -400,7 +403,6 @@ With it is possible to obtain the instance of the Request that ran it with the
400403If the Request is getting info, it is possible to obtain more information with
401404the ``getInfo `` method.
402405
403-
404406Conclusion
405407----------
406408
0 commit comments