testing/test_origin.ts

The origin an in-process test request comes from, and the headers such a request starts from. Dependency-free, so a cross-process suite reads it without pulling in the server assembly app_server.ts builds on.

view source

Declarations
#

2 declarations

create_test_request_headers
#

testing/test_origin.ts view source

(extra?: Record<string, string> | undefined): Record<string, string> import {create_test_request_headers} from '@fuzdev/fuz_app/testing/test_origin.js';

The headers every in-process test request starts from: host: localhost and TEST_ORIGIN, which the loopback allow list admits.

extra?

headers added after, replacing either of the defaults

type Record<string, string>
optional

returns

Record<string, string>

a fresh object

TEST_ORIGIN
#

testing/test_origin.ts view source

"http://localhost:5173" import {TEST_ORIGIN} from '@fuzdev/fuz_app/testing/test_origin.js';

The origin an in-process test request comes from — the dev server's, and the one origin create_loopback_app_server_options allows, so a request carrying it passes the origin check. It is also the Origin rpc_call sends cross-process, so a consumer's backend must allow it for rpc_call to pass the backend's origin check.

Depends on
#

Imported by
#