summaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/test/functions/cookies.test.js
blob: c8f409eec66587b0104bc10b4673869bed5a8cfb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import * as assert from 'node:assert/strict';
import { before, describe, it } from 'node:test';
import { loadFixture } from '../../../../astro/test/test-utils.js';

describe(
	'Cookies',
	() => {
		let fixture;

		before(async () => {
			fixture = await loadFixture({ root: new URL('./fixtures/cookies/', import.meta.url) });
			await fixture.build();
		});

		it('Can set multiple', async () => {
			const entryURL = new URL(
				'./fixtures/cookies/.netlify/v1/functions/ssr/ssr.mjs',
				import.meta.url,
			);
			const { default: handler } = await import(entryURL);
			const resp = await handler(
				new Request('http://example.com/login', { method: 'POST', body: '{}' }),
				{},
			);
			assert.equal(resp.status, 301);
			assert.equal(resp.headers.get('location'), '/');
			assert.deepEqual(resp.headers.getSetCookie(), ['foo=foo; HttpOnly', 'bar=bar; HttpOnly']);
		});

		it('renders dynamic 404 page', async () => {
			const entryURL = new URL(
				'./fixtures/cookies/.netlify/v1/functions/ssr/ssr.mjs',
				import.meta.url,
			);
			const { default: handler } = await import(entryURL);
			const resp = await handler(
				new Request('http://example.com/nonexistant-page', {
					headers: {
						'x-test': 'bar',
					},
				}),
				{},
			);
			assert.equal(resp.status, 404);
			const text = await resp.text();
			assert.equal(text.includes('This is my custom 404 page'), true);
			assert.equal(text.includes('x-test: bar'), true);
		});
	},
	{
		timeout: 120000,
	},
);
astro/commit/packages/astro/components/ViewTransitions.astro?h=@astrojs/internal-helpers@0.1.2&id=4e651af16fa544d1c1a381cc1b8380256f05f973&follow=1'>[ci] formatGravatar matthewp 1-1/+1 2023-08-02Fix scroll position in view transition (#7882) (#7911)Gravatar Martin Trapp 2-1/+6 2023-08-02Improve sourcemap generation and performance (#7901)Gravatar Bjorn Lu 11-27/+34 2023-08-01[ci] formatGravatar natemoo-re 1-1/+0 2023-08-01Fix astro/app import (#7821)Gravatar ottomated 4-1/+25 * core -> core.js * changeset * test --------- Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> 2023-08-01[ci] formatGravatar natemoo-re 1-1/+1 2023-08-01feat: add cache headers to assets in Vercel adapter (#7729)Gravatar Hee 10-3/+144 * feat: cache assets in Vercel adapter * Update tidy-tips-doubt.md * chore: update lockfile * Update packages/integrations/vercel/test/static-assets.test.js * Update packages/integrations/vercel/test/static-assets.test.js * Update packages/integrations/vercel/test/static-assets.test.js * chore: update split test --------- Co-authored-by: Kid <44045911+kidonng@users.noreply.github.com> Co-authored-by: Nate Moore <nate@astro.build> Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> 2023-08-01Fix "res.writeHead is not a function" in Express/node middleware (#7708)Gravatar DixCouleur 3-8/+34 * fix: res.writeHead is not a function * fix: handler params type added * fix: handler function params error * Update packages/integrations/node/src/nodeMiddleware.ts --------- Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> 2023-08-01Fix: Content Collections - Ignore `.json` files nested in non-underscored ↵Gravatar Tony Dang 3-1/+6 subdirectories within underscored directories (#7909) * test: add test file so tests fail before fix * fix: ignore files nested in underscore directories * chore: add changeset --------- Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> 2023-08-01chore: address feedback from #7754 (#7906)Gravatar Nate Moore 1-2/+4 2023-08-01[ci] release (#7877)astro@2.9.7@astrojs/vercel@3.7.5@astrojs/node@5.3.1@astrojs/netlify@2.5.2Gravatar Houston (Bot) 52-129/+128 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> 2023-08-01feat: add logging for when hydrate's JSON parse fails (#7887)Gravatar Sam Hulick 2-3/+28 Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> 2023-08-01Fix prefetch test fail (#7902)Gravatar Bjorn Lu 1-0/+2 2023-08-01[ci] formatGravatar bluwy 4-13/+28