Socket
Socket
Sign inDemoInstall

then-request

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

then-request - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

15

lib/index.js

@@ -63,2 +63,14 @@ 'use strict';

}());
var StreamBody = (function () {
function StreamBody(body) {
this._body = body;
}
StreamBody.prototype.getHeaders = function () {
return Promise.resolve({});
};
StreamBody.prototype.pipe = function (stream) {
this._body.pipe(stream);
};
return StreamBody;
}());
function handleBody(options) {

@@ -81,2 +93,5 @@ if (options.form) {

if (!Buffer.isBuffer(body)) {
if (typeof body.pipe === 'function') {
return new StreamBody(body);
}
throw new TypeError('body should be a Buffer or a String');

@@ -83,0 +98,0 @@ }

2

lib/Options.d.ts

@@ -30,4 +30,4 @@ /// <reference types="node" />

form?: FormData;
body?: string | Buffer;
body?: string | Buffer | NodeJS.ReadableStream;
}
export { Options };
{
"name": "then-request",
"version": "4.0.0",
"version": "4.1.0",
"description": "A request library that returns promises, inspired by request",

@@ -5,0 +5,0 @@ "keywords": [],

@@ -75,3 +75,3 @@ # then-request

- `headers` - http headers (default: `{}`)
- `body` - body for PATCH, POST and PUT requests. Must be a `Buffer` or `String` (only strings are accepted client side)
- `body` - body for PATCH, POST and PUT requests. Must be a `Buffer`, `ReadableStream` or `String` (only strings are accepted client side)
- `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json`. Does not have any affect on how the response is treated.

@@ -78,0 +78,0 @@ - `form` - You can pass a `FormData` instance to the `form` option, this will manage all the appropriate headers for you. Does not have any affect on how the response is treated.

Sorry, the diff of this file is not supported yet

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