HTTP API: Fix request header inconsistencies.

This changeset improves the consistency in capitalization of fetching and outputting of request headers. It also updates occurrences found in some docblocks.

Props johnjamesjacoby, costdev, audrasjb, petitphp, mhkuu, SergeyBiryukov.
Fixes #54225.


git-svn-id: https://develop.svn.wordpress.org/trunk@55210 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jb Audras
2023-02-03 13:33:18 +00:00
parent 4b71b1565a
commit 8fbe21a37a
29 changed files with 189 additions and 189 deletions

View File

@@ -283,7 +283,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
$this->skipTestOnTimeout( $res );
$this->assertNotWPError( $res );
$this->assertSame( '', $res['body'] ); // The body should be empty.
$this->assertEquals( $size, $res['headers']['content-length'] ); // Check the headers are returned (and the size is the same).
$this->assertEquals( $size, $res['headers']['Content-Length'] ); // Check the headers are returned (and the size is the same).
$this->assertSame( $size, $filesize ); // Check that the file is written to disk correctly without any extra characters.
$this->assertStringStartsWith( get_temp_dir(), $res['filename'] ); // Check it's saving within the temp directory.
}

View File

@@ -20,8 +20,8 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
$this->assertIsArray( $response );
$this->assertSame( 'image/jpeg', $headers['content-type'] );
$this->assertSame( '40148', $headers['content-length'] );
$this->assertSame( 'image/jpeg', $headers['Content-Type'] );
$this->assertSame( '40148', $headers['Content-Length'] );
$this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
}
@@ -65,8 +65,8 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
$this->assertIsArray( $response );
// Should return the same headers as a HEAD request.
$this->assertSame( 'image/jpeg', $headers['content-type'] );
$this->assertSame( '40148', $headers['content-length'] );
$this->assertSame( 'image/jpeg', $headers['Content-Type'] );
$this->assertSame( '40148', $headers['Content-Length'] );
$this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
}
@@ -86,8 +86,8 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
$headers = wp_remote_retrieve_headers( $response );
// Should return the same headers as a HEAD request.
$this->assertSame( 'image/jpeg', $headers['content-type'] );
$this->assertSame( '40148', $headers['content-length'] );
$this->assertSame( 'image/jpeg', $headers['Content-Type'] );
$this->assertSame( '40148', $headers['Content-Length'] );
$this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
}