diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index f1550e3910..f76122c00a 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -2697,4 +2697,43 @@ class SitesCustomServerTest extends Scope $this->cleanupSite($siteId); } + + public function testCookieHeader() + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Astro site', + 'framework' => 'astro', + 'adapter' => 'ssr', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './dist', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'fallbackFile' => '', + ]); + + $this->assertNotEmpty($siteId); + + $domain = $this->setupSiteDomain($siteId); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('astro'), + 'activate' => 'true' + ]); + + $this->assertNotEmpty($deploymentId); + + $domain = $this->getSiteDomain($siteId); + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/cookies', [ + 'cookie' => 'custom-session-id=abcd123' + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals("abcd123", $response['body']); + + $this->cleanupSite($siteId); + } } diff --git a/tests/resources/sites/astro/src/pages/cookies.js b/tests/resources/sites/astro/src/pages/cookies.js new file mode 100644 index 0000000000..5f5efac833 --- /dev/null +++ b/tests/resources/sites/astro/src/pages/cookies.js @@ -0,0 +1,4 @@ +export async function GET(context) { + const sessionId = context.cookies.get("custom-session-id")?.value ?? 'Custom session ID missing'; + return new Response(sessionId); +}