Socket
Socket
Sign inDemoInstall

teeny-request

Package Overview
Dependencies
Maintainers
3
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

teeny-request - npm Package Compare versions

Comparing version 3.11.3 to 4.0.0

32

build/src/index.js

@@ -8,3 +8,3 @@ "use strict";

return extendStatics(d, b);
}
};
return function (d, b) {

@@ -47,3 +47,3 @@ extendStatics(d, b);

function requestToFetchOptions(reqOpts) {
var options = __assign({ method: reqOpts.method || 'GET' }, reqOpts.timeout && { timeout: reqOpts.timeout }, reqOpts.gzip && { compress: reqOpts.gzip });
var options = __assign({ method: reqOpts.method || 'GET' }, (reqOpts.timeout && { timeout: reqOpts.timeout }), (reqOpts.gzip && { compress: reqOpts.gzip }));
if (typeof reqOpts.json === 'object') {

@@ -91,3 +91,3 @@ // Add Content-type: application/json header

var resHeaders = {};
res.headers.forEach(function (value, key) { return resHeaders[key] = value; });
res.headers.forEach(function (value, key) { return (resHeaders[key] = value); });
var response = Object.assign(res.body, {

@@ -140,8 +140,6 @@ statusCode: res.status,

var boundary = uuid.v4();
options.headers['Content-Type'] =
"multipart/related; boundary=" + boundary;
options.headers['Content-Type'] = "multipart/related; boundary=" + boundary;
options.body = createMultipartStream(boundary, multipart);
// Multipart upload
node_fetch_1.default(uri, options)
.then(function (res) {
node_fetch_1.default(uri, options).then(function (res) {
var header = res.headers.get('content-type');

@@ -171,18 +169,7 @@ var response = fetchToRequestResponse(reqOpts, res);

}
if (callback === undefined) { // Stream mode
if (callback === undefined) {
// Stream mode
var requestStream_1 = new stream_1.PassThrough();
options.compress = false;
node_fetch_1.default(uri, options)
.then(function (res) {
if (!res.ok) {
res.text().then(function (text) {
var error = new RequestError(text);
error.code = res.status;
requestStream_1.emit('error', error);
return;
}, function (error) {
requestStream_1.emit('error', error);
});
return;
}
node_fetch_1.default(uri, options).then(function (res) {
res.body.on('error', function (err) {

@@ -204,4 +191,3 @@ console.log('whoa there was an error, passing it on: ' + err);

// GET or POST with callback
node_fetch_1.default(uri, options)
.then(function (res) {
node_fetch_1.default(uri, options).then(function (res) {
var header = res.headers.get('content-type');

@@ -208,0 +194,0 @@ var response = fetchToRequestResponse(reqOpts, res);

{
"name": "teeny-request",
"version": "3.11.3",
"version": "4.0.0",
"description": "Like request, but smaller.",

@@ -44,3 +44,3 @@ "main": "./build/src/index.js",

"@types/mocha": "^5.2.5",
"@types/nock": "^9.3.0",
"@types/nock": "^10.0.0",
"@types/node-fetch": "^2.1.2",

@@ -50,6 +50,6 @@ "@types/request": "^2.47.1",

"codecov": "^3.1.0",
"gts": "^0.9.0",
"mocha": "^5.2.0",
"gts": "^1.0.0",
"mocha": "^6.0.0",
"nock": "^10.0.2",
"nyc": "^13.1.0",
"nyc": "^14.0.0",
"typescript": "^3.0.1"

@@ -56,0 +56,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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc