@@ -382,24 +382,7 @@ public function testExecute(): void
382382 $ response = $ this ->client ->call (Client::METHOD_POST , '/runtimes/test-exec/executions ' );
383383 $ this ->assertEquals (200 , $ response ['headers ' ]['status-code ' ]);
384384 $ this ->assertEquals (200 , $ response ['body ' ]['statusCode ' ]);
385-
386- // Example of expected headers:
387- // "[{"key":"x-my-cookie","value":"cookieValue"},{"key":"content-type","value":"application\/json; charset=utf-8"},{"key":"server","value":"swoole-http-server"},{"key":"date","value":"Tue, 02 Sep 2025 13:43:32 GMT"},{"key":"connection","value":"keep-alive"},{"key":"content-length","value":"235"}]"
388- $ headers = [];
389- foreach (\json_decode ($ response ['body ' ]['headers ' ], true ) as $ pair ) {
390- $ headers [$ pair ['key ' ]] = $ pair ['value ' ];
391- }
392- $ this ->assertEquals ('cookieValue ' , $ headers ['x-my-cookie ' ]);
393-
394- /** Execute with intentionally old version to ensure response filter */
395- $ response = $ this ->client ->call (Client::METHOD_POST , '/runtimes/test-exec/executions ' , [
396- 'x-executor-response-format ' => '0.8.6 '
397- ]);
398- $ this ->assertEquals (200 , $ response ['headers ' ]['status-code ' ]);
399- $ this ->assertEquals (200 , $ response ['body ' ]['statusCode ' ]);
400- // Example of expected headers:
401- // "{"x-my-cookie":"cookieValue","content-type":"application\/json; charset=utf-8","server":"swoole-http-server","date":"Tue, 02 Sep 2025 13:38:22 GMT","connection":"keep-alive","content-length":"235"}"
402- $ this ->assertEquals ('cookieValue ' , \json_decode ($ response ['body ' ]['headers ' ], true )['x-my-cookie ' ]);
385+ $ this ->assertEquals ('cookie1=value1; Path=/; HttpOnly; Secure; SameSite=Lax, cookie2=value2; Path=/; HttpOnly; Secure; SameSite=Lax ' , \json_decode ($ response ['body ' ]['headers ' ], true )['set-cookie ' ]);
403386
404387 /** Execute on cold-started runtime */
405388 $ response = $ this ->client ->call (Client::METHOD_POST , '/runtimes/test-exec/executions ' , [], [
@@ -550,6 +533,7 @@ public function testExecute(): void
550533 $ this ->assertEquals (200 , $ response ['headers ' ]['status-code ' ]);
551534 }
552535
536+ // We also test SSR two Set-cookie here
553537 public function testSSRLogs (): void
554538 {
555539 /** Prepare function */
@@ -586,6 +570,7 @@ public function testSSRLogs(): void
586570 $ this ->assertEquals (200 , $ response ['headers ' ]['status-code ' ]);
587571 $ this ->assertEquals (200 , $ response ['body ' ]['statusCode ' ]);
588572 $ this ->assertStringContainsString ('<p>OK</p> ' , $ response ['body ' ]['body ' ]);
573+ $ this ->assertEquals ('astroCookie1=astroValue1; Max-Age=1800; HttpOnly, astroCookie2=astroValue2; Max-Age=1800; HttpOnly ' , \json_decode ($ response ['body ' ]['headers ' ], true )['set-cookie ' ]);
589574
590575 $ this ->assertNotEmpty ($ response ['body ' ]['logs ' ]);
591576 $ this ->assertStringContainsString ('Open runtimes log ' , $ response ['body ' ]['logs ' ]);
0 commit comments