Socket
Socket
Sign inDemoInstall

bent

Package Overview
Dependencies
3
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.3.8 to 7.3.9

2

package.json
{
"name": "bent",
"version": "7.3.8",
"version": "7.3.9",
"description": "Functional HTTP client for Node.js w/ async/await.",

@@ -5,0 +5,0 @@ "main": "src/nodejs.js",

@@ -32,6 +32,10 @@ 'use strict'

} else if (typeof arg === 'object') {
if (headers) {
throw new Error('Cannot set headers twice.')
if (Array.isArray(arg) || arg instanceof Set) {
arg.forEach(code => statusCodes.add(code))
} else {
if (headers) {
throw new Error('Cannot set headers twice.')
}
headers = arg
}
headers = arg
} else {

@@ -38,0 +42,0 @@ throw new Error(`Unknown type: ${typeof arg}`)

@@ -123,2 +123,20 @@ /* globals atob, it */

test('multiple status', async () => {
const request = bent('string', [200, 201])
const str200 = await request(u('/echo.js?body=ok'))
same(str200, 'ok')
const str201 = await request(u('/echo.js?statusCode=201&body=ok'))
same(str201, 'ok')
try {
await request(u('/echo.js?statusCode=202&body=ok'))
throw new Error('Call should have thrown.')
} catch (e) {
same(e.message, process.browser ? null : 'Accepted')
// basic header test
same(e.headers['content-length'], '2')
}
})
test('PUT stream', async () => {

@@ -125,0 +143,0 @@ const body = Buffer.from(Math.random().toString())

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc