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.0.7 to 2.1.0

test/esm-wrapper.js

8

benchmarks/index.js

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

}))
.on('close', resolve)
.on('finish', resolve)
})

@@ -76,3 +76,3 @@ }))).then(() => deferred.resolve())

}))
.on('close', resolve)
.on('finish', resolve)
}))).then(() => deferred.resolve())

@@ -94,3 +94,3 @@ }

}))
.on('close', resolve)
.on('finish', resolve)
})

@@ -173,3 +173,3 @@ }))).then(() => deferred.resolve())

}
}).on('close', resolve)
}).on('finish', resolve)
}

@@ -176,0 +176,0 @@

@@ -62,3 +62,5 @@ 'use strict'

const nodeMajorVersion = parseInt(process.version.split('.')[0].slice(1))
const nodeVersions = process.version.split('.')
const nodeMajorVersion = parseInt(nodeVersions[0].slice(1))
const nodeMinorVersion = parseInt(nodeVersions[1])
const insecureHTTPParser = process.execArgv.includes('--insecure-http-parser')

@@ -350,3 +352,3 @@

/* istanbul ignore next */
if (nodeMajorVersion === 12) {
if (nodeMajorVersion === 12 && nodeMinorVersion < 19) {
super()

@@ -358,2 +360,10 @@ this.initialize(

)
} else if (nodeMajorVersion === 12 && nodeMinorVersion >= 19) {
super()
this.initialize(
HTTPParser.RESPONSE,
{},
client[kMaxHeadersSize],
client[kHeadersTimeout]
)
} else if (nodeMajorVersion > 12) {

@@ -548,3 +558,5 @@ super()

try {
request.onHeaders(statusCode, headers, statusCode < 200 ? null : socket[kResume])
if (request.onHeaders(statusCode, headers, statusCode < 200 ? null : socket[kResume]) === false) {
socket[kPause]()
}
} catch (err) {

@@ -551,0 +563,0 @@ util.destroy(socket, err)

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

for (let i = 0; i < headers.length; i += 2) {
processHeader(this, headers[i], headers[i + 1])
processHeader(this, headers[i + 0], headers[i + 1])
}

@@ -121,3 +121,3 @@ } else if (headers && typeof headers === 'object') {

this[kHandler].onHeaders(statusCode, headers, resume)
return this[kHandler].onHeaders(statusCode, headers, resume)
}

@@ -160,3 +160,3 @@

function processHeader (request, key, val) {
if (typeof val === 'object') {
if (val && typeof val === 'object') {
throw new InvalidArgumentError(`invalid ${key} header`)

@@ -163,0 +163,0 @@ } else if (val === undefined) {

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

@@ -9,3 +9,3 @@ "main": "index.js",

"lint": "standard | snazzy",
"test": "tap test/*.{mjs,js} --no-coverage && jest test/jest/test",
"test": "tap test/*.js --no-coverage && jest test/jest/test",
"coverage": "standard | snazzy && tap test/*.js",

@@ -12,0 +12,0 @@ "bench": "npx concurrently -k -s first \"node benchmarks/server.js\" \"node -e 'setTimeout(() => {}, 1000)' && node benchmarks\""

@@ -24,11 +24,2 @@ # undici

Node 14
```
http - keepalive x 7,179 ops/sec ±2.32% (272 runs sampled)
undici - pipeline x 16,843 ops/sec ±0.98% (279 runs sampled)
undici - request x 18,738 ops/sec ±0.67% (276 runs sampled)
undici - stream x 21,215 ops/sec ±0.66% (278 runs sampled)
undici - dispatch x 23,540 ops/sec ±0.62% (278 runs sampled)
```
Node 15

@@ -477,3 +468,3 @@ ```

* `socket: Duplex`
* `onHeaders(statusCode, headers, resume): Void`, invoked when statusCode and headers have been received.
* `onHeaders(statusCode, headers, resume): Boolean`, invoked when statusCode and headers have been received.
May be invoked multiple times due to 1xx informational headers.

@@ -480,0 +471,0 @@ * `statusCode: Number`

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

test('basic dispatch get', (t) => {
t.plan(10)
t.plan(11)

@@ -33,2 +33,3 @@ const server = http.createServer((req, res) => {

t.strictEqual('bar', req.headers.bar)
t.strictEqual('null', req.headers.baz)
t.strictEqual(undefined, req.headers['content-length'])

@@ -41,3 +42,4 @@ res.end('hello')

foo: undefined,
bar: 'bar'
bar: 'bar',
baz: null
}

@@ -44,0 +46,0 @@

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

test('invalid headers', (t) => {
t.plan(11)
t.plan(10)

@@ -84,12 +84,2 @@ const client = new Client('http://localhost:3000')

headers: {
asd: null
}
}, (err, data) => {
t.ok(err instanceof errors.InvalidArgumentError)
})
client.request({
path: '/',
method: 'GET',
headers: {
expect: '100-continue'

@@ -96,0 +86,0 @@ }

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