Socket
Socket
Sign inDemoInstall

undici

Package Overview
Dependencies
Maintainers
2
Versions
211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

undici - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

test/client-idempotent-body.js

15

lib/core/client.js

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

this[kTLSSession] = null
this[kHostHeader] = `host: ${this[kUrl].hostname}\r\n`
this[kHostHeader] = `host: ${this[kUrl].hostname}${this[kUrl].port ? `:${this[kUrl].port}` : ''}\r\n`

@@ -655,2 +655,7 @@ // kQueue is built up of 3 sections separated by

}
destroy () {
this.unconsume()
setImmediate((self) => self.close(), this)
}
}

@@ -710,4 +715,3 @@

parser.unconsume()
setImmediate(() => parser.close())
parser.destroy()

@@ -750,6 +754,7 @@ if (err.code !== 'UND_ERR_INFO') {

function detachSocket (socket) {
socket[kParser].destroy()
socket[kParser] = null
socket[kPause] = null
socket[kResume] = null
socket[kClient] = null
socket[kParser] = null
socket[kError] = null

@@ -1128,4 +1133,2 @@ socket

}
request.body = null
} else {

@@ -1132,0 +1135,0 @@ client[kWriting] = true

2

package.json
{
"name": "undici",
"version": "2.1.0",
"version": "2.1.1",
"description": "An HTTP/1.1 client, written from scratch for Node.js",

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

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

t.strictEqual('GET', req.method)
t.strictEqual('localhost', req.headers.host)
t.strictEqual(`localhost:${server.address().port}`, req.headers.host)
t.strictEqual(undefined, req.headers.foo)

@@ -81,3 +81,3 @@ t.strictEqual('bar', req.headers.bar)

t.strictEqual('GET', req.method)
t.strictEqual('localhost', req.headers.host)
t.strictEqual(`localhost:${server.address().port}`, req.headers.host)
t.strictEqual(undefined, req.headers.foo)

@@ -84,0 +84,0 @@ t.strictEqual('bar', req.headers.bar)

@@ -282,1 +282,43 @@ 'use strict'

})
test('Disable keep alive concurrency 1', (t) => {
t.plan(8)
const ports = []
const server = http.createServer((req, res) => {
t.false(ports.includes(req.socket.remotePort))
ports.push(req.socket.remotePort)
t.match(req.headers, { connection: 'close' })
res.writeHead(200, { connection: 'close' })
res.end()
})
t.teardown(server.close.bind(server))
server.listen(0, () => {
const client = new Client(`http://localhost:${server.address().port}`, {
keepAlive: false,
pipelining: 2
})
t.teardown(client.destroy.bind(client))
client.request({
path: '/',
method: 'GET'
}, (err, { body }) => {
t.error(err)
body.on('end', () => {
t.pass()
}).resume()
})
client.request({
path: '/',
method: 'GET'
}, (err, { body }) => {
t.error(err)
body.on('end', () => {
t.pass()
}).resume()
})
})
})

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

t.strictEqual('GET', req.method)
t.strictEqual('localhost', req.headers.host)
t.strictEqual(`localhost:${server.address().port}`, req.headers.host)
t.strictEqual(undefined, req.headers['content-length'])

@@ -24,0 +24,0 @@ res.setHeader('Content-Type', 'text/plain')

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

t.strictEqual('GET', req.method)
t.strictEqual('localhost', req.headers.host)
t.strictEqual(`localhost:${server.address().port}`, req.headers.host)
res.setHeader('content-type', 'text/plain')

@@ -57,3 +57,3 @@ res.end('hello')

t.strictEqual('GET', req.method)
t.strictEqual('localhost', req.headers.host)
t.strictEqual(`localhost:${server.address().port}`, req.headers.host)
res.setHeader('content-type', 'text/plain')

@@ -93,3 +93,3 @@ res.end('hello')

t.strictEqual('GET', req.method)
t.strictEqual('localhost', req.headers.host)
t.strictEqual(`localhost:${server.address().port}`, req.headers.host)
res.setHeader('content-type', 'text/plain')

@@ -96,0 +96,0 @@ res.end('hello')

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

t.strictEqual('GET', req.method)
t.strictEqual('localhost', req.headers.host)
t.strictEqual(`localhost:${server.address().port}`, req.headers.host)
t.strictEqual(undefined, req.headers.foo)

@@ -84,3 +84,3 @@ t.strictEqual('bar', req.headers.bar)

t.strictEqual('HEAD', req.method)
t.strictEqual('localhost', req.headers.host)
t.strictEqual(`localhost:${server.address().port}`, req.headers.host)
res.setHeader('content-type', 'text/plain')

@@ -87,0 +87,0 @@ res.end('hello')

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

expect(req.method).toBe('POST')
expect(req.headers.host).toBe('localhost')
expect(req.headers.host).toBe(`localhost:${server.address().port}`)
res.setHeader('Content-Type', 'text/plain')

@@ -14,0 +14,0 @@ res.end('hello')

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc