undici-thread-interceptor
Advanced tools
Comparing version 0.10.0 to 0.10.1
10
index.js
@@ -284,6 +284,14 @@ 'use strict' | ||
const headers = {} | ||
for (const [key, value] of Object.entries(opts.headers)) { | ||
if (value !== undefined && value !== null) { | ||
headers[key] = value | ||
} | ||
} | ||
const injectOpts = { | ||
method: opts.method, | ||
url: opts.path, | ||
headers: opts.headers, | ||
headers, | ||
query: opts.query, | ||
@@ -290,0 +298,0 @@ body: opts.body instanceof Uint8Array ? Buffer.from(opts.body) : opts.body, |
{ | ||
"name": "undici-thread-interceptor", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"description": "An Undici interceptor that routes requests over a worker thread", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -415,1 +415,21 @@ 'use strict' | ||
}) | ||
test('empty header', async (t) => { | ||
const worker = new Worker(join(__dirname, 'fixtures', 'empty-headers.js')) | ||
t.after(() => worker.terminate()) | ||
const interceptor = createThreadInterceptor({ | ||
domain: '.local', | ||
}) | ||
interceptor.route('myserver', worker) | ||
const agent = new Agent().compose(interceptor) | ||
const { statusCode, body } = await request('http://myserver.local', { | ||
dispatcher: agent, | ||
headers: { foo: undefined } | ||
}) | ||
strictEqual(statusCode, 200) | ||
deepStrictEqual(await body.text(), 'hello world') | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71554
39
1915