mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
HTTP API: Add the missing 1xx
HTTP response codes as constants of the WP_Http
class, and add tests to ensure all available response codes are covered.
Fixes #36294 git-svn-id: https://develop.svn.wordpress.org/trunk@36749 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c51647b0b2
commit
717c1c4041
@ -21,6 +21,10 @@
|
||||
class WP_Http {
|
||||
|
||||
// Aliases for HTTP response codes.
|
||||
const HTTP_CONTINUE = 100;
|
||||
const SWITCHING_PROTOCOLS = 101;
|
||||
const PROCESSING = 102;
|
||||
|
||||
const OK = 200;
|
||||
const CREATED = 201;
|
||||
const ACCEPTED = 202;
|
||||
|
@ -102,4 +102,20 @@ class Tests_HTTP_HTTP extends WP_UnitTestCase {
|
||||
- ://example.com - assumed path in PHP >= 5.4.7, fails in <5.4.7
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 35426
|
||||
*/
|
||||
public function test_http_response_code_constants() {
|
||||
global $wp_header_to_desc;
|
||||
|
||||
$ref = new ReflectionClass( 'WP_Http' );
|
||||
$constants = $ref->getConstants();
|
||||
|
||||
// This primes the `$wp_header_to_desc` global:
|
||||
get_status_header_desc( 200 );
|
||||
|
||||
$this->assertEquals( array_keys( $wp_header_to_desc ), array_values( $constants ) );
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user