Requests_Transport_cURL::get_expect_header() WordPress Method

The get_expect_header() method is used in the Requests_Transport_cURL class to return the Expect: header. This header is used to tell the server what kind of response is expected.

Requests_Transport_cURL::get_expect_header( string|array $data ) #

Get the correct “Expect” header for the given request data.


Parameters

$data

(string|array)(Required)Data to send either as the POST body, or as parameters in the URL for a GET/HEAD.


Top ↑

Return

(string) The "Expect" header.


Top ↑

Source

File: wp-includes/Requests/Transport/cURL.php

	protected function get_expect_header($data) {
		if (!is_array($data)) {
			return strlen((string) $data) >= 1048576 ? '100-Continue' : '';
		}

		$bytesize = 0;
		$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($data));

		foreach ($iterator as $datum) {
			$bytesize += strlen((string) $datum);

			if ($bytesize >= 1048576) {
				return '100-Continue';
			}
		}

		return '';
	}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.