New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

undici

Package Overview
Dependencies
Maintainers
3
Versions
235
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 4.10.0 to 4.10.1

13

lib/fetch/formdata.js
'use strict'
const { Blob } = require('buffer')
const { isBlobLike, toUSVString } = require('./util')
const { kState } = require('./symbols')
const { File } = require('./file')
const { toUSVString } = require('./util')

@@ -28,3 +27,3 @@ class FormData {

}
if (args.length === 3 && !(args[1] instanceof Blob)) {
if (args.length === 3 && !isBlobLike(args[1])) {
throw new TypeError(

@@ -38,3 +37,3 @@ "Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'"

// 1. Let value be value if given; otherwise blobValue.
const value = args[1] instanceof Blob ? args[1] : toUSVString(args[1])
const value = isBlobLike(args[1]) ? args[1] : toUSVString(args[1])

@@ -140,3 +139,3 @@ // 2. Let entry be the result of creating an entry with

}
if (args.length === 3 && !(args[1] instanceof Blob)) {
if (args.length === 3 && !isBlobLike(args[1])) {
throw new TypeError(

@@ -153,3 +152,3 @@ "Failed to execute 'set' on 'FormData': parameter 2 is not of type 'Blob'"

// 1. Let value be value if given; otherwise blobValue.
const value = args[1] instanceof Blob ? args[1] : toUSVString(args[1])
const value = isBlobLike(args[1]) ? args[1] : toUSVString(args[1])

@@ -221,3 +220,3 @@ // 2. Let entry be the result of creating an entry with name, value, and

// object, representing the same bytes, whose name attribute value is "blob".
if (value instanceof Blob && !(value instanceof File)) {
if (isBlobLike(value) && !(value instanceof File)) {
value = new File([value], 'blob')

@@ -224,0 +223,0 @@ }

@@ -10,6 +10,2 @@ // https://github.com/Ethan-Arrowood/undici-fetch

const {
InvalidHTTPTokenError,
HTTPInvalidHeaderValueError
} = require('../core/errors')
const {
forbiddenHeaderNames,

@@ -38,3 +34,3 @@ forbiddenResponseHeaderNames

if (name === undefined) {
throw new InvalidHTTPTokenError(`Header name ${name}`)
throw new TypeError(`Header name ${name}`)
}

@@ -48,3 +44,3 @@ const normalizedHeaderName = name.toLocaleLowerCase()

if (value === undefined) {
throw new HTTPInvalidHeaderValueError(value, name)
throw new TypeError(value, name)
}

@@ -51,0 +47,0 @@ const normalizedHeaderValue = `${value}`.replace(

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

// throw a RangeError.
if ('status' in init) {
if ('status' in init && init.status !== undefined) {
if (!Number.isFinite(init.status)) {

@@ -121,3 +121,3 @@ throw new TypeError()

if ('statusText' in init) {
if ('statusText' in init && init.statusText !== undefined) {
// 2. If init["statusText"] does not match the reason-phrase token

@@ -144,3 +144,3 @@ // production, then throw a TypeError.

// 5. Set this’s response’s status to init["status"].
if ('status' in init) {
if ('status' in init && init.status !== undefined) {
this[kState].status = init.status

@@ -150,3 +150,3 @@ }

// 6. Set this’s response’s status message to init["statusText"].
if ('statusText' in init) {
if ('statusText' in init && init.statusText !== undefined) {
this[kState].statusText = String(init.statusText)

@@ -153,0 +153,0 @@ }

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

const { performance } = require('perf_hooks')
const { Blob } = require('buffer')
const nodeUtil = require('util')

@@ -72,2 +73,14 @@

// based on https://github.com/node-fetch/fetch-blob/blob/8ab587d34080de94140b54f07168451e7d0b655e/index.js#L229-L241 (MIT License)
function isBlobLike (object) {
return object instanceof Blob || (
object &&
typeof object === 'object' &&
typeof object.constructor === 'function' &&
(typeof object.stream === 'function' ||
typeof object.arrayBuffer === 'function') &&
/^(Blob|File)$/.test(object[Symbol.toStringTag])
)
}
// Check whether |statusText| is a ByteString and

@@ -354,3 +367,4 @@ // matches the Reason-Phrase token production.

responseLocationURL,
isBlobLike,
isValidReasonPhrase
}

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

host
},
}
},

@@ -45,3 +45,3 @@ handler

function buildProxyOptions(opts) {
function buildProxyOptions (opts) {
if (typeof opts === 'string') {

@@ -48,0 +48,0 @@ opts = { uri: opts }

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

@@ -66,2 +66,3 @@ "homepage": "https://undici.nodejs.org",

"docsify-cli": "^4.4.3",
"formdata-node": "^4.3.1",
"https-pem": "^2.0.0",

@@ -68,0 +69,0 @@ "husky": "^7.0.2",

@@ -165,3 +165,3 @@ # undici

Only supported on Node 16+.
Only supported on Node 16.5+.

@@ -168,0 +168,0 @@ This is [experimental](https://nodejs.org/api/documentation.html#documentation_stability_index) and is not yet fully compliant with the Fetch Standard. We plan to ship breaking changes to this feature until it is out of experimental.

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