WP_Http::browser_redirect_compatibility( string $location, array $headers, string|array $data, array $options, Requests_Response $original )

Match redirect behaviour to browser handling.


Description 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 Parameters

$location

(string) (Required) URL to redirect to.

$headers

(array) (Required) Headers for the redirect.

$data

(string|array) (Required) Body to send with the request.

$options

(array) (Required) Redirect request options.

$original

(Requests_Response) (Required) Response object.


Top ↑

Source Source

File: wp-includes/class-http.php

	public static function browser_redirect_compatibility( $location, $headers, $data, &$options, $original ) {
		// Browser compat
		if ( $original->status_code === 302 ) {
			$options['type'] = Requests::GET;
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
4.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.