Socket
Socket
Sign inDemoInstall

http-request-retry

Package Overview
Dependencies
53
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

.idea/inspectionProfiles/Project_Default.xml

15

index.js
let _ = require('lodash');
let _request = require('request');
let queryString = require('query-string');

@@ -17,3 +18,3 @@ let HTTPService = {

let requestCallback = (options = {}, done)=>{
done = done || function (){};
done = done || function (err, res){};
options.method = options.method || "POST";

@@ -24,2 +25,8 @@ options.json = true;

options.headers = _.extend(options.headers || {}, { 'Content-Type': 'application/json; charset=UTF-8' });
if(options.method === 'GET' || options.method === 'get')
{
if(options.url && options.url.indexOf('?') === -1 && _.isObject(options.body)){
options.url = options.url + '?' + queryString.stringify(options.body);
}
}
_request(options, (error, response, body) => {

@@ -48,2 +55,8 @@ let statusCode = (response && response.statusCode ) ? response.statusCode : 400;

options.timeout = options.timeout || 60*1000;
if(options.method === 'GET' || options.method === 'get')
{
if(options.url && options.url.indexOf('?') === -1 && _.isObject(options.body)){
options.url = options.url + '?' + queryString.stringify(options.body);
}
}
_request(options, (error, response, body) => {

@@ -50,0 +63,0 @@ let statusCode = (response && response.statusCode ) ? response.statusCode : 400;

7

package.json
{
"name": "http-request-retry",
"version": "1.0.3",
"version": "1.0.4",
"description": "request can retry if fail",

@@ -19,5 +19,6 @@ "repository": "https://github.com/xitrumuit1991/http-request-retry",

"dependencies": {
"lodash": "4.17.11",
"request": "2.88.0"
"lodash": "^4.17.11",
"query-string": "^6.2.0",
"request": "^2.88.0"
}
}

Sorry, the diff of this file is not supported yet

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