Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@toruslabs/http-helpers

Package Overview
Dependencies
Maintainers
3
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@toruslabs/http-helpers - npm Package Compare versions

Comparing version 1.3.6 to 1.3.7

15

dist/httpHelpers-node.js

@@ -282,4 +282,3 @@ module.exports =

'Content-Type': 'application/json; charset=utf-8'
},
body: customOptions.isUrlEncodedData ? data : JSON.stringify(data)
}
};

@@ -293,3 +292,13 @@

method: 'POST'
}]);
}]); // deep merge changes the structure of form data and url encoded data ,
// so we should not deepmerge body data
options.body = customOptions.isUrlEncodedData ? data : JSON.stringify(data); // for multipart request browser/client will add multipart content type
// along with multipart boundary , so for multipart request send
// content-type: undefined or send with multipart boundary if already known
if (options.headers['Content-Type'] === undefined) {
delete options.headers['Content-Type'];
}
return promiseTimeout(customOptions.timeout || 30000, fetch(url, options).then(function (response) {

@@ -296,0 +305,0 @@ if (response.ok) {

2

dist/httpHelpers.cjs.js

@@ -1,1 +0,1 @@

module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(e,t){e.exports=require("@babel/runtime/regenerator")},function(e,t){e.exports=require("deepmerge")},function(e,t){e.exports=require("@babel/runtime/helpers/asyncToGenerator")},function(e,t){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,t,r){"use strict";r.r(t),r.d(t,"gatewayAuthHeader",(function(){return b})),r.d(t,"gatewayEmbedHostHeader",(function(){return m})),r.d(t,"setEmbedHost",(function(){return y})),r.d(t,"clearEmbedHost",(function(){return v})),r.d(t,"getEmbedHost",(function(){return g})),r.d(t,"setAPIKey",(function(){return O})),r.d(t,"clearAPIKey",(function(){return P})),r.d(t,"getAPIKey",(function(){return j})),r.d(t,"promiseTimeout",(function(){return x})),r.d(t,"get",(function(){return T})),r.d(t,"post",(function(){return E})),r.d(t,"patch",(function(){return k})),r.d(t,"remove",(function(){return S})),r.d(t,"generateJsonRPCObject",(function(){return A})),r.d(t,"promiseRace",(function(){return H}));var n=r(0),o=r.n(n),u=r(3),i=r.n(u),c=r(2),a=r.n(c),s=r(1),f=r.n(s);function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var l="torus-default",h="",b="x-api-key",m="x-embed-host";function y(e){h=e}function v(){h=""}function g(){return h}function O(e){l=e}function P(){l="torus-default"}function j(){return l}function w(){var e={};return l&&(e[b]=l),h&&(e[m]=h),e}var x=function(e,t){var r=new Promise((function(t,r){var n=setTimeout((function(){clearTimeout(n),r(new Error("Timed out in ".concat(e,"ms")))}),e)}));return Promise.race([t,r])},T=function(){var e=a()(o.a.mark((function e(t){var r,n,u,i,c,a=arguments;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},n=a.length>2&&void 0!==a[2]?a[2]:{},u={mode:"cors",headers:{}},n.useAPIKey&&(u.headers=p(p({},u.headers),w())),i=f.a.all([u,r,{method:"GET"}]),e.next=7,fetch(t,i);case 7:if(!(c=e.sent).ok){e.next=10;break}return e.abrupt("return",c.json());case 10:throw c;case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),E=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"},body:n.isUrlEncodedData?t:JSON.stringify(t)};n.useAPIKey&&(o.headers=p(p({},o.headers),w()));var u=f.a.all([o,r,{method:"POST"}]);return x(n.timeout||3e4,fetch(e,u).then((function(e){if(e.ok)return e.json();throw e})))},k=function(){var e=a()(o.a.mark((function e(t){var r,n,u,i,c,a,s=arguments;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:{},n=s.length>2&&void 0!==s[2]?s[2]:{},u=s.length>3&&void 0!==s[3]?s[3]:{},i={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify(r)},u.useAPIKey&&(i.headers=p(p({},i.headers),w())),c=f.a.all([i,n,{method:"PATCH"}]),e.next=8,fetch(t,c);case 8:if(!(a=e.sent).ok){e.next=11;break}return e.abrupt("return",a.json());case 11:throw a;case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),S=function(){var e=a()(o.a.mark((function e(t){var r,n,u,i,c,a=arguments;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a.length>1&&void 0!==a[1]?a[1]:{},r=a.length>2&&void 0!==a[2]?a[2]:{},n=a.length>3&&void 0!==a[3]?a[3]:{},u={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}},n.useAPIKey&&(u.headers=p(p({},u.headers),w())),i=f.a.all([u,r,{method:"DELETE"}]),e.next=8,fetch(t,i);case 8:if(!(c=e.sent).ok){e.next=11;break}return e.abrupt("return",c.json());case 11:throw c;case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),A=function(e,t){return{jsonrpc:"2.0",method:e,id:10,params:t}},H=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e4;return Promise.race([T(e,t),new Promise((function(e,t){setTimeout((function(){t(new Error("timed out"))}),r)}))])}}]);
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(e,t){e.exports=require("@babel/runtime/regenerator")},function(e,t){e.exports=require("deepmerge")},function(e,t){e.exports=require("@babel/runtime/helpers/asyncToGenerator")},function(e,t){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,t,r){"use strict";r.r(t),r.d(t,"gatewayAuthHeader",(function(){return b})),r.d(t,"gatewayEmbedHostHeader",(function(){return m})),r.d(t,"setEmbedHost",(function(){return y})),r.d(t,"clearEmbedHost",(function(){return v})),r.d(t,"getEmbedHost",(function(){return g})),r.d(t,"setAPIKey",(function(){return O})),r.d(t,"clearAPIKey",(function(){return P})),r.d(t,"getAPIKey",(function(){return j})),r.d(t,"promiseTimeout",(function(){return x})),r.d(t,"get",(function(){return T})),r.d(t,"post",(function(){return E})),r.d(t,"patch",(function(){return k})),r.d(t,"remove",(function(){return S})),r.d(t,"generateJsonRPCObject",(function(){return A})),r.d(t,"promiseRace",(function(){return C}));var n=r(0),o=r.n(n),u=r(3),i=r.n(u),a=r(2),c=r.n(a),s=r(1),f=r.n(s);function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var l="torus-default",h="",b="x-api-key",m="x-embed-host";function y(e){h=e}function v(){h=""}function g(){return h}function O(e){l=e}function P(){l="torus-default"}function j(){return l}function w(){var e={};return l&&(e[b]=l),h&&(e[m]=h),e}var x=function(e,t){var r=new Promise((function(t,r){var n=setTimeout((function(){clearTimeout(n),r(new Error("Timed out in ".concat(e,"ms")))}),e)}));return Promise.race([t,r])},T=function(){var e=c()(o.a.mark((function e(t){var r,n,u,i,a,c=arguments;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=c.length>1&&void 0!==c[1]?c[1]:{},n=c.length>2&&void 0!==c[2]?c[2]:{},u={mode:"cors",headers:{}},n.useAPIKey&&(u.headers=p(p({},u.headers),w())),i=f.a.all([u,r,{method:"GET"}]),e.next=7,fetch(t,i);case 7:if(!(a=e.sent).ok){e.next=10;break}return e.abrupt("return",a.json());case 10:throw a;case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),E=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};n.useAPIKey&&(o.headers=p(p({},o.headers),w()));var u=f.a.all([o,r,{method:"POST"}]);return u.body=n.isUrlEncodedData?t:JSON.stringify(t),void 0===u.headers["Content-Type"]&&delete u.headers["Content-Type"],x(n.timeout||3e4,fetch(e,u).then((function(e){if(e.ok)return e.json();throw e})))},k=function(){var e=c()(o.a.mark((function e(t){var r,n,u,i,a,c,s=arguments;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:{},n=s.length>2&&void 0!==s[2]?s[2]:{},u=s.length>3&&void 0!==s[3]?s[3]:{},i={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify(r)},u.useAPIKey&&(i.headers=p(p({},i.headers),w())),a=f.a.all([i,n,{method:"PATCH"}]),e.next=8,fetch(t,a);case 8:if(!(c=e.sent).ok){e.next=11;break}return e.abrupt("return",c.json());case 11:throw c;case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),S=function(){var e=c()(o.a.mark((function e(t){var r,n,u,i,a,c=arguments;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c.length>1&&void 0!==c[1]?c[1]:{},r=c.length>2&&void 0!==c[2]?c[2]:{},n=c.length>3&&void 0!==c[3]?c[3]:{},u={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}},n.useAPIKey&&(u.headers=p(p({},u.headers),w())),i=f.a.all([u,r,{method:"DELETE"}]),e.next=8,fetch(t,i);case 8:if(!(a=e.sent).ok){e.next=11;break}return e.abrupt("return",a.json());case 11:throw a;case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),A=function(e,t){return{jsonrpc:"2.0",method:e,id:10,params:t}},C=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e4;return Promise.race([T(e,t),new Promise((function(e,t){setTimeout((function(){t(new Error("timed out"))}),r)}))])}}]);
{
"name": "@toruslabs/http-helpers",
"version": "1.3.6",
"version": "1.3.7",
"description": "http helpers",

@@ -24,25 +24,24 @@ "main": "dist/httpHelpers.cjs.js",

"devDependencies": {
"@babel/cli": "^7.12.13",
"@babel/core": "^7.12.13",
"@babel/cli": "^7.12.17",
"@babel/core": "^7.12.17",
"@babel/plugin-proposal-object-rest-spread": "^7.12.13",
"@babel/plugin-transform-runtime": "^7.12.13",
"@babel/preset-env": "^7.12.13",
"@babel/runtime-corejs3": "^7.12.13",
"@babel/plugin-transform-runtime": "^7.12.17",
"@babel/preset-env": "^7.12.17",
"@babel/runtime-corejs3": "^7.12.18",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.2",
"eslint": "7.19.0",
"eslint": "7.20.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^7.2.0",
"eslint-config-prettier": "^8.0.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-standard": "^4.1.0",
"eslint-webpack-plugin": "^2.4.3",
"eslint-webpack-plugin": "^2.5.2",
"husky": "^4.3.8",
"lint-staged": "^10.5.3",
"lint-staged": "^10.5.4",
"node-fetch": "^2.6.1",

@@ -49,0 +48,0 @@ "parallel-webpack": "^2.6.0",

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