Skip to content

Commit 0c166d2

Browse files
committed
test: fix the testcase to follow the http response spec.
1 parent 917607c commit 0c166d2

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

tests/system/HTTP/CURLRequestTest.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,23 +1110,29 @@ public function testUserAgentOption(): void
11101110
$this->assertSame($agent, $options[CURLOPT_USERAGENT]);
11111111
}
11121112

1113+
/**
1114+
* @see https://github.com/codeigniter4/CodeIgniter4/issues/8347
1115+
*/
11131116
public function testMultipleHTTP100(): void
11141117
{
1115-
$output = 'HTTP/1.1 100 Continue
1116-
Mark bundle as not supporting multiuse
1117-
HTTP/1.1 100 Continue
1118-
Mark bundle as not supporting multiuse
1119-
HTTP/1.1 200 OK
1120-
Server: Werkzeug/2.2.2 Python/3.7.17
1121-
Date: Sun, 28 Jan 2024 06:05:36 GMT
1122-
Content-Type: application/json
1123-
Content-Length: 33
1124-
Connection: close';
1118+
$jsonBody = '{"name":"John Doe","age":30}';
1119+
1120+
$output = "HTTP/1.1 100 Continue
1121+
Mark bundle as not supporting multiuse
1122+
HTTP/1.1 100 Continue
1123+
Mark bundle as not supporting multiuse
1124+
HTTP/1.1 200 OK
1125+
Server: Werkzeug/2.2.2 Python/3.7.17
1126+
Date: Sun, 28 Jan 2024 06:05:36 GMT
1127+
Content-Type: application/json
1128+
Content-Length: 33\r\n\r\n" . $jsonBody;
11251129

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

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

1134+
$this->assertSame($jsonBody, $response->getBody());
1135+
11301136
$this->assertSame(200, $response->getStatusCode());
11311137
}
11321138
}

0 commit comments

Comments
 (0)