headers.test.js — astro Source File
Architecture documentation for headers.test.js, a javascript file in the astro codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 8fe488d9_c95f_b581_8d96_7a0f731f76df["headers.test.js"] e9d931b2_ed62_4e03_ce5f_2c9923774bd8["../../../dist/core/app/createOutgoingHttpHeaders.js"] 8fe488d9_c95f_b581_8d96_7a0f731f76df --> e9d931b2_ed62_4e03_ce5f_2c9923774bd8 e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] 8fe488d9_c95f_b581_8d96_7a0f731f76df --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 8fe488d9_c95f_b581_8d96_7a0f731f76df --> 6b0635f9_51ea_77aa_767b_7857878e98a6 style 8fe488d9_c95f_b581_8d96_7a0f731f76df fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import * as assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { createOutgoingHttpHeaders } from '../../../dist/core/app/createOutgoingHttpHeaders.js';
describe('createOutgoingHttpHeaders', () => {
it('undefined input headers', async () => {
const result = createOutgoingHttpHeaders(undefined);
assert.equal(result, undefined);
});
it('null input headers', async () => {
const result = createOutgoingHttpHeaders(undefined);
assert.equal(result, undefined);
});
it('Empty Headers', async () => {
const headers = new Headers();
const result = createOutgoingHttpHeaders(headers);
assert.equal(result, undefined);
});
it('Headers with single key', async () => {
const headers = new Headers();
headers.append('x-test', 'hello world');
const result = createOutgoingHttpHeaders(headers);
assert.deepEqual(result, { 'x-test': 'hello world' });
});
it('Headers with multiple keys', async () => {
const headers = new Headers();
headers.append('x-test1', 'hello');
headers.append('x-test2', 'world');
const result = createOutgoingHttpHeaders(headers);
assert.deepEqual(result, { 'x-test1': 'hello', 'x-test2': 'world' });
});
it('Headers with multiple values (not set-cookie)', async () => {
const headers = new Headers();
headers.append('x-test', 'hello');
headers.append('x-test', 'world');
const result = createOutgoingHttpHeaders(headers);
assert.deepEqual(result, { 'x-test': 'hello, world' });
});
it('Headers with multiple values (set-cookie special case)', async () => {
const headers = new Headers();
headers.append('set-cookie', 'hello');
headers.append('set-cookie', 'world');
const result = createOutgoingHttpHeaders(headers);
assert.deepEqual(result, { 'set-cookie': ['hello', 'world'] });
});
it('Headers with multiple values (set-cookie case handling)', async () => {
const headers = new Headers();
headers.append('Set-cookie', 'hello');
headers.append('Set-Cookie', 'world');
const result = createOutgoingHttpHeaders(headers);
assert.deepEqual(result, { 'set-cookie': ['hello', 'world'] });
});
it('Headers with all use cases', async () => {
const headers = new Headers();
headers.append('x-single', 'single');
headers.append('x-triple', 'one');
headers.append('x-triple', 'two');
headers.append('x-triple', 'three');
headers.append('Set-cookie', 'hello');
headers.append('Set-Cookie', 'world');
const result = createOutgoingHttpHeaders(headers);
assert.deepEqual(result, {
'x-single': 'single',
'x-triple': 'one, two, three',
'set-cookie': ['hello', 'world'],
});
});
});
Domain
Dependencies
- ../../../dist/core/app/createOutgoingHttpHeaders.js
- node:test
- strict
Source
Frequently Asked Questions
What does headers.test.js do?
headers.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does headers.test.js depend on?
headers.test.js imports 3 module(s): ../../../dist/core/app/createOutgoingHttpHeaders.js, node:test, strict.
Where is headers.test.js in the architecture?
headers.test.js is located at packages/astro/test/units/app/headers.test.js (domain: IntegrationAdapters, directory: packages/astro/test/units/app).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free