Skip to content

Commit 8d903a0

Browse files
committed
docs: improve explanation
1 parent ef37e12 commit 8d903a0

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

user_guide_src/source/libraries/curlrequest.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,11 @@ further headers arrays or calls to ``setHeader()``.
272272
http_errors
273273
===========
274274

275-
By default, CURLRequest will fail if the HTTP code returned is greater than or equal to 400. You can set
276-
``http_errors`` to ``false`` to return the content instead:
275+
By default, CURLRequest will throw ``HTTPException`` if the HTTP code returned is
276+
greater than or equal to 400.
277+
278+
If you want to see the response body, you can set ``http_errors`` to ``false`` to
279+
return the content instead:
277280

278281
.. literalinclude:: curlrequest/026.php
279282

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php
22

33
$client->request('GET', '/status/500');
4-
// Will fail verbosely
4+
// If the response code is 500, an HTTPException is thrown,
5+
// and a detailed error report is displayed if in development mode.
56

6-
$res = $client->request('GET', '/status/500', ['http_errors' => false]);
7-
echo $res->getStatusCode();
8-
// 500
7+
$response = $client->request('GET', '/status/500', ['http_errors' => false]);
8+
echo $response->getStatusCode(); // 500
9+
echo $response->getBody(); // You can see the response body.

0 commit comments

Comments
 (0)