Server: appserver-7f0f8755-nginx-15961cad18524ec5a9db05f2a6a7e440
Current directory: /code/wp-includes/Requests/src
Software: nginx/1.27.5
Shell Command
Create a new file
Upload file
File: Response.php
headers = new Headers(); $this->cookies = new Jar(); } /** * Is the response a redirect? * * @return boolean True if redirect (3xx status), false if not. */ public function is_redirect() { $code = $this->status_code; return in_array($code, [300, 301, 302, 303, 307], true) || $code > 307 && $code < 400; } /** * Throws an exception if the request was not successful * * @param boolean $allow_redirects Set to false to throw on a 3xx as well * * @throws \WpOrg\Requests\Exception If `$allow_redirects` is false, and code is 3xx (`response.no_redirects`) * @throws \WpOrg\Requests\Exception\Http On non-successful status code. Exception class corresponds to "Status" + code (e.g. {@see \WpOrg\Requests\Exception\Http\Status404}) */ public function throw_for_status($allow_redirects = true) { if ($this->is_redirect()) { if ($allow_redirects !== true) { throw new Exception('Redirection not allowed', 'response.no_redirects', $this); } } elseif (!$this->success) { $exception = Http::get_class($this->status_code); throw new $exception(null, $this); } } /** * JSON decode the response body. * * The method parameters are the same as those for the PHP native `json_decode()` function. * * @link https://php.net/json-decode * * @param bool|null $associative Optional. When `true`, JSON objects will be returned as associative arrays; * When `false`, JSON objects will be returned as objects. * When `null`, JSON objects will be returned as associative arrays * or objects depending on whether `JSON_OBJECT_AS_ARRAY` is set in the flags. * Defaults to `true` (in contrast to the PHP native default of `null`). * @param int $depth Optional. Maximum nesting depth of the structure being decoded. * Defaults to `512`. * @param int $options Optional. Bitmask of JSON_BIGINT_AS_STRING, JSON_INVALID_UTF8_IGNORE, * JSON_INVALID_UTF8_SUBSTITUTE, JSON_OBJECT_AS_ARRAY, JSON_THROW_ON_ERROR. * Defaults to `0` (no options set). * * @return array * * @throws \WpOrg\Requests\Exception If `$this->body` is not valid json. */ public function decode_body($associative = true, $depth = 512, $options = 0) { $data = json_decode($this->body, $associative, $depth, $options); if (json_last_error() !== JSON_ERROR_NONE) { $last_error = json_last_error_msg(); throw new Exception('Unable to parse JSON data: ' . $last_error, 'response.invalid', $this); } return $data; } }
.
24 Items
Change directory
Remove directory
Rename directory
..
2 Items
Change directory
Remove directory
Rename directory
Auth
1 Items
Change directory
Remove directory
Rename directory
Auth.php
0.84 KB
Edit
Delete
Copy
Move
Remame
Autoload.php
9.12 KB
Edit
Delete
Copy
Move
Remame
Capability.php
0.64 KB
Edit
Delete
Copy
Move
Remame
Cookie
1 Items
Change directory
Remove directory
Rename directory
Cookie.php
15.03 KB
Edit
Delete
Copy
Move
Remame
Exception
6 Items
Change directory
Remove directory
Rename directory
Exception.php
1.09 KB
Edit
Delete
Copy
Move
Remame
HookManager.php
0.69 KB
Edit
Delete
Copy
Move
Remame
Hooks.php
2.96 KB
Edit
Delete
Copy
Move
Remame
IdnaEncoder.php
12.14 KB
Edit
Delete
Copy
Move
Remame
Ipv6.php
5.51 KB
Edit
Delete
Copy
Move
Remame
Iri.php
28.93 KB
Edit
Delete
Copy
Move
Remame
Port.php
1.47 KB
Edit
Delete
Copy
Move
Remame
Proxy
1 Items
Change directory
Remove directory
Rename directory
Proxy.php
0.85 KB
Edit
Delete
Copy
Move
Remame
Requests.php
33.2 KB
Edit
Delete
Copy
Move
Remame
Response
1 Items
Change directory
Remove directory
Rename directory
Response.php
4.18 KB
Edit
Delete
Copy
Move
Remame
Session.php
8.89 KB
Edit
Delete
Copy
Move
Remame
Ssl.php
5.3 KB
Edit
Delete
Copy
Move
Remame
Transport
2 Items
Change directory
Remove directory
Rename directory
Transport.php
1.51 KB
Edit
Delete
Copy
Move
Remame
Utility
3 Items
Change directory
Remove directory
Rename directory