HTTP API: Replace internals with Requests library.

Requests is a library very similar to WP_HTTP, with a high level of unit test coverage, and has a common lineage and development team. It also supports parallel requests.

See #33055.


git-svn-id: https://develop.svn.wordpress.org/trunk@37428 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan McCue
2016-05-13 04:41:45 +00:00
parent e2329076f3
commit 9074e9f93b
65 changed files with 6999 additions and 92 deletions

View File

@@ -19,7 +19,6 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
$response = wp_remote_head( $url );
$headers = wp_remote_retrieve_headers( $response );
$this->assertInternalType( 'array', $headers, "Reply wasn't array." );
$this->assertEquals( 'image/jpeg', $headers['content-type'] );
$this->assertEquals( '40148', $headers['content-length'] );
$this->assertEquals( '200', wp_remote_retrieve_response_code( $response ) );
@@ -36,7 +35,6 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
$url = 'https://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
$headers = wp_remote_head( $url );
$this->assertInternalType( 'array', $headers, "Reply wasn't array." );
$this->assertEquals( '404', wp_remote_retrieve_response_code( $headers ) );
}
@@ -47,7 +45,6 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
$headers = wp_remote_retrieve_headers( $response );
// should return the same headers as a head request
$this->assertInternalType( 'array', $headers, "Reply wasn't array." );
$this->assertEquals( 'image/jpeg', $headers['content-type'] );
$this->assertEquals( '40148', $headers['content-length'] );
$this->assertEquals( '200', wp_remote_retrieve_response_code( $response ) );
@@ -61,7 +58,6 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
$headers = wp_remote_retrieve_headers( $response );
// should return the same headers as a head request
$this->assertInternalType( 'array', $headers, "Reply wasn't array." );
$this->assertEquals( 'image/jpeg', $headers['content-type'] );
$this->assertEquals( '40148', $headers['content-length'] );
$this->assertEquals( '200', wp_remote_retrieve_response_code( $response ) );
@@ -85,7 +81,6 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
$response = wp_remote_head( $url );
$cookies = wp_remote_retrieve_cookies( $response );
$this->assertInternalType( 'array', $cookies );
$this->assertNotEmpty( $cookies );
$cookie = wp_remote_retrieve_cookie( $response, 'wordpress_test_cookie' );