MCPcopy Create free account
hub / github.com/cfworker/cfworker / assertCanReadRequestCookieHeader

Function assertCanReadRequestCookieHeader

packages/dev/test/run-command.spec.js:105–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

103}
104
105export async function assertCanReadRequestCookieHeader() {
106 const cookie = 'test cookie';
107 const entry = './test/fixtures/worker.js';
108 const code = `
109 addEventListener('fetch', event => {
110 const cookie = event.request.headers.get('cookie');
111 const response = new Response(cookie, { status: 200 });
112 event.respondWith(response);
113 });`;
114 await fs.outputFile(entry, code);
115 const { RunCommand } = await import('../src/cli/run-command.js');
116 const command = new RunCommand({
117 entry,
118 port,
119 inspect: false,
120 watch: false,
121 check: true,
122 kv: []
123 });
124 await command.execute();
125 const response = await fetch('http://localhost:7000', {
126 headers: { cookie }
127 });
128 assert.equal(response.status, 200);
129 assert.equal(await response.text(), cookie);
130 command.dispose();
131}
132
133export async function assertCanRespondWithSetCookieHeader() {
134 const cookie = 'test cookie';

Callers

nothing calls this directly

Calls 3

executeMethod · 0.95
disposeMethod · 0.95
textMethod · 0.45

Tested by

no test coverage detected