Requests_Transport_cURL::get_expect_header()protectedWP 1.0

Get the correct "Expect" header for the given request data.

{} It's a method of the class: Requests_Transport_cURL{}

No Hooks.

Return

String. The "Expect" header.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_expect_header( $data );
$data(string|array) (required)
Data to send either as the POST body, or as parameters in the URL for a GET/HEAD.

Code of Requests_Transport_cURL::get_expect_header() WP 6.0

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 '';
}