Socket
Socket
Sign inDemoInstall

teeny-request

Package Overview
Dependencies
Maintainers
1
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.2.1 to 3.3.0

2

build/src/index.d.ts
import * as r from 'request';
declare function teenyRequest(reqOpts: r.OptionsWithUri, callback: any): void;
declare function teenyRequest(reqOpts: r.OptionsWithUri, callback?: any): void;
declare namespace teenyRequest {

@@ -4,0 +4,0 @@ function defaults(defaults: r.OptionsWithUri): (reqOpts: r.UriOptions & r.CoreOptions, callback: any) => void;

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

function requestToFetchOptions(reqOpts) {
const options = Object.assign({}, reqOpts.headers && { headers: reqOpts.headers }, reqOpts.method && { method: reqOpts.method }, reqOpts.json && { body: JSON.stringify(reqOpts.json) }, reqOpts.timeout && { timeout: reqOpts.timeout }, reqOpts.gzip && { compress: reqOpts.gzip });
const options = Object.assign({}, reqOpts.headers && { headers: reqOpts.headers }, reqOpts.method && { method: reqOpts.method }, reqOpts.json && { body: JSON.stringify(reqOpts.body) }, reqOpts.timeout && { timeout: reqOpts.timeout }, reqOpts.gzip && { compress: reqOpts.gzip });
let uri = reqOpts.uri;

@@ -36,9 +36,22 @@ if (reqOpts.useQuerystring === true) {

}
res.json().then(json => {
let header = res.headers.get('content-type');
if (header === 'application/json') {
let response = fetchToRequestResponse(res);
response.body = json;
callback(null, response, json);
}).catch((err) => {
res.json().then(json => {
response.body = json;
callback(null, response, json);
}).catch(err => {
callback(err);
});
return;
}
res.text().then(text => {
let response = fetchToRequestResponse(res);
response.body = text;
callback(null, response, text);
}).catch(err => {
callback(err);
});
}).catch(err => {
callback(err);
});

@@ -45,0 +58,0 @@ }

{
"name": "teeny-request",
"version": "3.2.1",
"version": "3.3.0",
"description": "Like request, but smaller.",

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

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