Skip to content

Commit

Permalink
test: fix the testcase to follow the http response spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
ping-yee committed Feb 13, 2024
1 parent 917607c commit 0c166d2
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions tests/system/HTTP/CURLRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1110,23 +1110,29 @@ public function testUserAgentOption(): void
$this->assertSame($agent, $options[CURLOPT_USERAGENT]);
}

/**
* @see https://github.com/codeigniter4/CodeIgniter4/issues/8347
*/
public function testMultipleHTTP100(): void
{
$output = 'HTTP/1.1 100 Continue
Mark bundle as not supporting multiuse
HTTP/1.1 100 Continue
Mark bundle as not supporting multiuse
HTTP/1.1 200 OK
Server: Werkzeug/2.2.2 Python/3.7.17
Date: Sun, 28 Jan 2024 06:05:36 GMT
Content-Type: application/json
Content-Length: 33
Connection: close';
$jsonBody = '{"name":"John Doe","age":30}';

$output = "HTTP/1.1 100 Continue
Mark bundle as not supporting multiuse
HTTP/1.1 100 Continue
Mark bundle as not supporting multiuse
HTTP/1.1 200 OK
Server: Werkzeug/2.2.2 Python/3.7.17
Date: Sun, 28 Jan 2024 06:05:36 GMT
Content-Type: application/json
Content-Length: 33\r\n\r\n" . $jsonBody;

$this->request->setOutput($output);

$response = $this->request->request('get', 'http://example.com');

$this->assertSame($jsonBody, $response->getBody());

$this->assertSame(200, $response->getStatusCode());
}
}

0 comments on commit 0c166d2

Please sign in to comment.