Skip to content

Commit 8be0277

Browse files
committed
test: add test for multiple headers
1 parent fff435c commit 8be0277

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/system/HTTP/CURLRequestDoNotShareOptionsTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,38 @@ public function testResponseHeadersWithMultipleRequests(): void
852852
$this->assertSame(200, $response->getStatusCode());
853853
}
854854

855+
public function testResponseHeadersWithMultipleSetCookies(): void
856+
{
857+
$request = $this->getRequest([
858+
'base_uri' => 'https://github.com/',
859+
]);
860+
861+
$output = "HTTP/2 200
862+
server: GitHub.com
863+
date: Sat, 11 Nov 2023 02:26:55 GMT
864+
content-type: text/html; charset=utf-8
865+
set-cookie: _gh_sess=PlRlha1YumlLhLuo5MuNbIWJRO9RRuR%2FHfYsWRh5B0mkalFIZstlAbTmSstl8q%2FAC57IsWMVuFHWQc6L4qDHQJrwhuYVO5ZaigPCUjAStnhh%2FieZQVqIf92Al7vusuzx2o8XH%2Fv6nd9qzMTAWc2%2FkRsl8jxPQYGNaWeuUBY2w3%2FDORSikN4c0vHOyedhU7Xcv3Ryz5xD3DNxK9R8xKNZ6OSXLJ6bjX8iIT6LxvroVIf2HjvowW9cQsq0kN08mS6KtTnH0mD3ANWqsVVWeMzFNA%3D%3D--Jx830Q9Nmkfz9OGA--kEcPtNphvjNMopYqFDxUbw%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
866+
set-cookie: _octo=GH1.1.599292127.1699669625; Path=/; Domain=github.com; Expires=Mon, 11 Nov 2024 02:27:05 GMT; Secure; SameSite=Lax
867+
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Mon, 11 Nov 2024 02:27:05 GMT; HttpOnly; Secure; SameSite=Lax
868+
accept-ranges: bytes\x0d\x0a\x0d\x0a";
869+
$request->setOutput($output);
870+
871+
$response = $request->get('/');
872+
873+
$setCookieHeaders = $response->header('set-cookie');
874+
875+
$this->assertCount(3, $setCookieHeaders);
876+
$this->assertSame(
877+
'logged_in=no; Path=/; Domain=github.com; Expires=Mon, 11 Nov 2024 02:27:05 GMT; HttpOnly; Secure; SameSite=Lax',
878+
$setCookieHeaders[2]->getValue()
879+
);
880+
881+
$this->assertSame(
882+
'_octo=GH1.1.599292127.1699669625; Path=/; Domain=github.com; Expires=Mon, 11 Nov 2024 02:27:05 GMT; Secure; SameSite=Lax',
883+
$setCookieHeaders[1]->getValueLine()
884+
);
885+
}
886+
855887
public function testSplitResponse(): void
856888
{
857889
$request = $this->getRequest([

0 commit comments

Comments
 (0)