Match redirect behavior to browser handling.
Description
Changes 302 redirects from POST to GET to match browser handling. Per RFC 7231, user agents can deviate from the strict reading of the specification for compatibility purposes.
Parameters
$location
stringrequired- URL to redirect to.
$headers
arrayrequired- Headers for the redirect.
$data
string|arrayrequired- Body to send with the request.
$options
arrayrequired- Redirect request options.
$original
WpOrgRequestsResponserequired- Response object.
Source
public static function browser_redirect_compatibility( $location, $headers, $data, &$options, $original ) {
// Browser compatibility.
if ( 302 === $original->status_code ) {
$options['type'] = WpOrg\Requests\Requests::GET;
}
}
Changelog
Version | Description |
---|---|
4.6.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.