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

http-client

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-client - npm Package Compare versions

Comparing version 2.1.2 to 2.2.0

7

lib/index.js

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

});
exports.requestInfo = exports.parseJSON = exports.parseText = exports.params = exports.json = exports.body = exports.query = exports.base = exports.accept = exports.auth = exports.header = exports.method = exports.createFetch = exports.createStack = undefined;
exports.requestInfo = exports.parseJSON = exports.parseText = exports.params = exports.json = exports.body = exports.query = exports.base = exports.accept = exports.auth = exports.header = exports.method = exports.createFetch = exports.createStack = exports.fetch = undefined;

@@ -13,3 +13,3 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

var globalFetch = typeof fetch === 'function' ? fetch : (typeof window === 'undefined' ? 'undefined' : _typeof(window)) !== 'object' && require('node-fetch');
var globalFetch = typeof fetch !== 'function' ? (typeof window === 'undefined' ? 'undefined' : _typeof(window)) !== 'object' && require('node-fetch') : fetch;

@@ -24,5 +24,8 @@ var stringifyQuery = function stringifyQuery(query) {

exports.fetch = globalFetch;
/**
* Creates a middleware "stack" function using all arguments.
*/
var createStack = exports.createStack = function createStack() {

@@ -29,0 +32,0 @@ for (var _len = arguments.length, middleware = Array(_len), _key = 0; _key < _len; _key++) {

{
"name": "http-client",
"version": "2.1.2",
"version": "2.2.0",
"description": "Compose HTTP clients using JavaScript's fetch API",

@@ -5,0 +5,0 @@ "author": "Michael Jackson",

@@ -62,3 +62,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

});
exports.requestInfo = exports.parseJSON = exports.parseText = exports.params = exports.json = exports.body = exports.query = exports.base = exports.accept = exports.auth = exports.header = exports.method = exports.createFetch = exports.createStack = undefined;
exports.requestInfo = exports.parseJSON = exports.parseText = exports.params = exports.json = exports.body = exports.query = exports.base = exports.accept = exports.auth = exports.header = exports.method = exports.createFetch = exports.createStack = exports.fetch = undefined;

@@ -69,3 +69,3 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

var globalFetch = typeof fetch === 'function' ? fetch : ( false ? 'undefined' : _typeof(window)) !== 'object' && __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"node-fetch\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()));
var globalFetch = typeof fetch !== 'function' ? ( false ? 'undefined' : _typeof(window)) !== 'object' && __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"node-fetch\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())) : fetch;

@@ -80,5 +80,8 @@ var stringifyQuery = function stringifyQuery(query) {

exports.fetch = globalFetch;
/**
* Creates a middleware "stack" function using all arguments.
*/
var createStack = exports.createStack = function createStack() {

@@ -85,0 +88,0 @@ for (var _len = arguments.length, middleware = Array(_len), _key = 0; _key < _len; _key++) {

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

!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.HTTPClient=n():t.HTTPClient=n()}(this,function(){return function(t){function n(r){if(e[r])return e[r].exports;var o=e[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.requestInfo=n.parseJSON=n.parseText=n.params=n.json=n.body=n.query=n.base=n.accept=n.auth=n.header=n.method=n.createFetch=n.createStack=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},o=e(1),u="function"==typeof fetch?fetch:"object"!==r(window)&&e(!function(){var t=new Error('Cannot find module "node-fetch"');throw t.code="MODULE_NOT_FOUND",t}()),i=function(t){return"string"==typeof t?t:(0,o.stringify)(t)},c=function(t,n,e){return t(n,e)},f=n.createStack=function(){for(var t=arguments.length,n=Array(t),e=0;t>e;e++)n[e]=arguments[e];return 0===n.length?c:n.reduceRight(function(t,n){return function(e,r,o){return n(function(n,r){return t(e,n,r)},r,o)}})},a=(n.createFetch=function(){if(0===arguments.length)return fetch;var t=f.apply(void 0,arguments);return function(n,e){return t(u,n,e)}},function(t,n,e){return(t.headers||(t.headers={}))[n]=e}),s=(n.method=function(t){return function(n,e){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return r.method=t,n(e,r)}},n.header=function(t,n){return function(e,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return a(o,t,n),e(r,o)}}),p=(n.auth=function(t){return s("Authorization",t)},n.accept=function(t){return s("Accept",t)},n.base=function(t){return function(n,e,r){return n(t+e,r)}},n.query=function(t){var n=i(t);return function(t,e,r){return t(e+(-1===e.indexOf("?")?"?":"&")+n,r)}}),d=n.body=function(t,n){return function(e,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return o.body=t,null!=t.length&&a(o,"Content-Length",t.length),n&&a(o,"Content-Type",n),e(r,o)}},l=(n.json=function(t){return d("string"==typeof t?t:JSON.stringify(t),"application/json")},n.params=function(t){var n=i(t);return function(t,e){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],o=(r.method||"GET").toUpperCase(),u="GET"===o||"HEAD"===o?p(n):d(n,"application/x-www-form-urlencoded");return u(t,e,r)}},function(t){return function(n,e,r){return n(e,r).then(t)}});n.parseText=function(){var t=arguments.length<=0||void 0===arguments[0]?"textString":arguments[0];return l(function(n){return n.text().then(function(e){return n[t]=e,n})})},n.parseJSON=function(){var t=arguments.length<=0||void 0===arguments[0]?"jsonData":arguments[0];return l(function(n){return n.json().then(function(e){return n[t]=e,n},function(t){throw new Error("Error parsing JSON: "+t.stack)})})},n.requestInfo=function(){return function(t,n,e){return t(n,e).then(function(t){return t.requestURL=n,t.requestOptions=e,t},function(){var t=arguments.length<=0||void 0===arguments[0]?new Error:arguments[0];throw t.requestURL=n,t.requestOptions=e,t})}}},function(t,n,e){"use strict";var r=e(2);n.extract=function(t){return t.split("?")[1]||""},n.parse=function(t){return"string"!=typeof t?{}:(t=t.trim().replace(/^(\?|#|&)/,""),t?t.split("&").reduce(function(t,n){var e=n.replace(/\+/g," ").split("="),r=e.shift(),o=e.length>0?e.join("="):void 0;return r=decodeURIComponent(r),o=void 0===o?null:decodeURIComponent(o),t.hasOwnProperty(r)?Array.isArray(t[r])?t[r].push(o):t[r]=[t[r],o]:t[r]=o,t},{}):{})},n.stringify=function(t){return t?Object.keys(t).sort().map(function(n){var e=t[n];return void 0===e?"":null===e?n:Array.isArray(e)?e.slice().sort().map(function(t){return r(n)+"="+r(t)}).join("&"):r(n)+"="+r(e)}).filter(function(t){return t.length>0}).join("&"):""}},function(t,n){"use strict";t.exports=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}}])});
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.HTTPClient=n():t.HTTPClient=n()}(this,function(){return function(t){function n(r){if(e[r])return e[r].exports;var o=e[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.requestInfo=n.parseJSON=n.parseText=n.params=n.json=n.body=n.query=n.base=n.accept=n.auth=n.header=n.method=n.createFetch=n.createStack=n.fetch=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},o=e(1),u="function"!=typeof fetch?"object"!==r(window)&&e(!function(){var t=new Error('Cannot find module "node-fetch"');throw t.code="MODULE_NOT_FOUND",t}()):fetch,i=function(t){return"string"==typeof t?t:(0,o.stringify)(t)},c=function(t,n,e){return t(n,e)};n.fetch=u;var f=n.createStack=function(){for(var t=arguments.length,n=Array(t),e=0;t>e;e++)n[e]=arguments[e];return 0===n.length?c:n.reduceRight(function(t,n){return function(e,r,o){return n(function(n,r){return t(e,n,r)},r,o)}})},a=(n.createFetch=function(){if(0===arguments.length)return fetch;var t=f.apply(void 0,arguments);return function(n,e){return t(u,n,e)}},function(t,n,e){return(t.headers||(t.headers={}))[n]=e}),s=(n.method=function(t){return function(n,e){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return r.method=t,n(e,r)}},n.header=function(t,n){return function(e,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return a(o,t,n),e(r,o)}}),p=(n.auth=function(t){return s("Authorization",t)},n.accept=function(t){return s("Accept",t)},n.base=function(t){return function(n,e,r){return n(t+e,r)}},n.query=function(t){var n=i(t);return function(t,e,r){return t(e+(-1===e.indexOf("?")?"?":"&")+n,r)}}),d=n.body=function(t,n){return function(e,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return o.body=t,null!=t.length&&a(o,"Content-Length",t.length),n&&a(o,"Content-Type",n),e(r,o)}},l=(n.json=function(t){return d("string"==typeof t?t:JSON.stringify(t),"application/json")},n.params=function(t){var n=i(t);return function(t,e){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],o=(r.method||"GET").toUpperCase(),u="GET"===o||"HEAD"===o?p(n):d(n,"application/x-www-form-urlencoded");return u(t,e,r)}},function(t){return function(n,e,r){return n(e,r).then(t)}});n.parseText=function(){var t=arguments.length<=0||void 0===arguments[0]?"textString":arguments[0];return l(function(n){return n.text().then(function(e){return n[t]=e,n})})},n.parseJSON=function(){var t=arguments.length<=0||void 0===arguments[0]?"jsonData":arguments[0];return l(function(n){return n.json().then(function(e){return n[t]=e,n},function(t){throw new Error("Error parsing JSON: "+t.stack)})})},n.requestInfo=function(){return function(t,n,e){return t(n,e).then(function(t){return t.requestURL=n,t.requestOptions=e,t},function(){var t=arguments.length<=0||void 0===arguments[0]?new Error:arguments[0];throw t.requestURL=n,t.requestOptions=e,t})}}},function(t,n,e){"use strict";var r=e(2);n.extract=function(t){return t.split("?")[1]||""},n.parse=function(t){return"string"!=typeof t?{}:(t=t.trim().replace(/^(\?|#|&)/,""),t?t.split("&").reduce(function(t,n){var e=n.replace(/\+/g," ").split("="),r=e.shift(),o=e.length>0?e.join("="):void 0;return r=decodeURIComponent(r),o=void 0===o?null:decodeURIComponent(o),t.hasOwnProperty(r)?Array.isArray(t[r])?t[r].push(o):t[r]=[t[r],o]:t[r]=o,t},{}):{})},n.stringify=function(t){return t?Object.keys(t).sort().map(function(n){var e=t[n];return void 0===e?"":null===e?n:Array.isArray(e)?e.slice().sort().map(function(t){return r(n)+"="+r(t)}).join("&"):r(n)+"="+r(e)}).filter(function(t){return t.length>0}).join("&"):""}},function(t,n){"use strict";t.exports=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}}])});
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