Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

undici-thread-interceptor

Package Overview
Dependencies
Maintainers
8
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

undici-thread-interceptor - npm Package Compare versions

Comparing version 0.11.0 to 0.11.1

2

index.js

@@ -443,3 +443,3 @@ 'use strict'

/* c8 ignore next 7 */
if (data[0] instanceof Buffer || data[0] instanceof Uint8Array) {
if (data[0] instanceof Buffer || data[0] instanceof Uint8Array || data.length === 0) {
return Buffer.concat(data)

@@ -446,0 +446,0 @@ } else {

{
"name": "undici-thread-interceptor",
"version": "0.11.0",
"version": "0.11.1",
"description": "An Undici interceptor that routes requests over a worker thread",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -499,1 +499,20 @@ 'use strict'

})
test('empty-stream', async (t) => {
const worker = new Worker(join(__dirname, 'fixtures', 'worker1.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/empty-stream', {
dispatcher: agent,
})
strictEqual(statusCode, 200)
deepStrictEqual(await body.text(), '')
})

@@ -94,2 +94,13 @@ 'use strict'

app.get('/empty-stream', (req, reply) => {
// The content-lengh header is necessary to make sure that
// the mesh network collects the whole body
reply.header('content-length', 0)
reply.send(new Readable({
read () {
this.push(null)
},
}))
})
app.post('/echo-body', (req, reply) => {

@@ -96,0 +107,0 @@ reply.send(req.body)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc