WordPress.org

Make WordPress Core

Changeset 1231 in tests


Ignore:
Timestamp:
03/04/13 06:19:32 (14 months ago)
Author:
dd32
Message:

Rename the WP_HTTP testcase 'test_location_header_on_200' to 'test_location_header_on_201' and modify test / test script accordingly, PHP doesn't allow us to issue a Location with a 200 response, and the ticket it refers to is specifically about 201 responses.
See #16889

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/data/WPHTTP-testcase-redirection-script.php

    r370 r1231  
    2424    exit; 
    2525} 
    26 if ( isset($_GET['200-location']) ) { 
    27     header("HTTP/1.1 200 OK"); 
     26if ( isset($_GET['201-location']) ) { 
     27    header("HTTP/1.1 201 OK"); 
    2828    if ( isset($_GET['fail']) ) { 
    2929        echo "FAIL"; 
    3030    } else { 
    31         header("Location: $url?200-location&fail=true", true, 200); 
     31        header("Location: $url?201-location&fail=true", true, 201); 
    3232        echo "PASS"; 
    3333    } 
  • trunk/tests/http/base.php

    r1205 r1231  
    132132     * 
    133133     * @ticket 16889 
    134      * 
    135      * Is this valid? Streams, cURL and therefore PHP Extension (ie. all PHP Internal) follow redirects 
    136      * on all status codes, currently all of WP_HTTP follows this template. 
    137134     */ 
    138     function test_location_header_on_200() { 
     135    function test_location_header_on_201() { 
    139136        // Prints PASS on initial load, FAIL if the client follows the specified redirection 
    140         $res = wp_remote_request( $this->redirection_script . '?200-location=true' ); 
     137        $res = wp_remote_request( $this->redirection_script . '?201-location=true' ); 
    141138        $this->assertFalse( is_wp_error( $res ) ); 
    142139        $this->assertEquals( 'PASS', $res['body']); 
Note: See TracChangeset for help on using the changeset viewer.