http-client
Advanced tools
Comparing version 4.1.0 to 4.1.1
@@ -16,2 +16,4 @@ 'use strict'; | ||
var globalFetch = fetch; | ||
var stringifyQuery = function stringifyQuery(query) { | ||
@@ -46,5 +48,5 @@ return typeof query === 'string' ? query : (0, _queryString.stringify)(query); | ||
var globalFetch = enhanceFetch(fetch); | ||
var enhancedGlobalFetch = enhanceFetch(globalFetch); | ||
exports.fetch = globalFetch; | ||
exports.fetch = enhancedGlobalFetch; | ||
@@ -79,3 +81,3 @@ | ||
var createFetch = exports.createFetch = function createFetch() { | ||
if (arguments.length === 0) return globalFetch; | ||
if (arguments.length === 0) return enhancedGlobalFetch; | ||
@@ -82,0 +84,0 @@ var stack = createStack.apply(undefined, arguments); |
{ | ||
"name": "http-client", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "Compose HTTP clients using JavaScript's fetch API", | ||
"repository": "mjackson/http-client", | ||
"author": "Michael Jackson", | ||
@@ -13,3 +14,2 @@ "license": "MIT", | ||
"scripts": { | ||
"lint": "eslint modules", | ||
"build": "node ./scripts/build.js", | ||
@@ -21,2 +21,3 @@ "build-lib": "rimraf lib && babel ./modules -d lib --ignore '__tests__'", | ||
"prepublish": "node ./scripts/build.js", | ||
"lint": "eslint modules", | ||
"test": "npm run lint && karma start" | ||
@@ -35,3 +36,3 @@ }, | ||
"es6-promise": "^3.1.2", | ||
"eslint": "^2.5.1", | ||
"eslint": "^3.2.2", | ||
"eslint-plugin-import": "^1.7.0", | ||
@@ -42,19 +43,15 @@ "expect": "^1.14.0", | ||
"isomorphic-fetch": "^2.2.1", | ||
"karma": "^0.13.21", | ||
"karma-browserstack-launcher": "^1.0.0", | ||
"karma": "^1.1.2", | ||
"karma-browserstack-launcher": "^1.0.1", | ||
"karma-chrome-launcher": "^1.0.1", | ||
"karma-mocha": "^1.0.1", | ||
"karma-mocha-reporter": "^2.0.3", | ||
"karma-mocha": "^1.1.1", | ||
"karma-mocha-reporter": "^2.0.4", | ||
"karma-sourcemap-loader": "^0.3.7", | ||
"karma-webpack": "^1.7.0", | ||
"mocha": "^2.4.5", | ||
"pretty-bytes": "^3.0.1", | ||
"mocha": "^3.0.0", | ||
"pretty-bytes": "^4.0.2", | ||
"readline-sync": "^1.4.1", | ||
"rimraf": "^2.5.2", | ||
"webpack": "^1.12.14" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mjackson/http-client.git" | ||
} | ||
} |
@@ -72,2 +72,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var globalFetch = fetch; | ||
var stringifyQuery = function stringifyQuery(query) { | ||
@@ -102,5 +104,5 @@ return typeof query === 'string' ? query : (0, _queryString.stringify)(query); | ||
var globalFetch = enhanceFetch(fetch); | ||
var enhancedGlobalFetch = enhanceFetch(globalFetch); | ||
exports.fetch = globalFetch; | ||
exports.fetch = enhancedGlobalFetch; | ||
@@ -135,3 +137,3 @@ | ||
var createFetch = exports.createFetch = function createFetch() { | ||
if (arguments.length === 0) return globalFetch; | ||
if (arguments.length === 0) return enhancedGlobalFetch; | ||
@@ -395,3 +397,3 @@ var stack = createStack.apply(undefined, arguments); | ||
if (val === null) { | ||
return key; | ||
return encode(key, opts); | ||
} | ||
@@ -398,0 +400,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.HTTPClient=t():n.HTTPClient=t()}(this,function(){return function(n){function t(r){if(e[r])return e[r].exports;var o=e[r]={exports:{},id:r,loaded:!1};return n[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var e={};return t.m=n,t.c=e,t.p="",t(0)}([function(n,t,e){"use strict";function r(n){return n&&n.__esModule?n:{"default":n}}Object.defineProperty(t,"__esModule",{value:!0}),t.requestInfo=t.parseJSON=t.parseText=t.handleResponse=t.onResponse=t.params=t.json=t.body=t.query=t.base=t.accept=t.auth=t.header=t.method=t.init=t.createFetch=t.createStack=t.fetch=t.enhanceFetch=void 0;var o=e(3),u=e(1),i=r(u),c=function(n){return"string"==typeof n?n:(0,o.stringify)(n)},f=function(n){return"string"==typeof n?n:JSON.stringify(n)},a=function(n,t){return t.reduce(function(n,t){return n.then(t)},Promise.resolve(n))},s=t.enhanceFetch=function(n){return function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return n(t,e).then(function(n){var t=e.responseHandlers;return t&&t.length?a(n,t):n})}},p=s(fetch);t.fetch=p;var l=function(n,t,e){return n(t,e)},d=t.createStack=function(){for(var n=arguments.length,t=Array(n),e=0;n>e;e++)t[e]=arguments[e];return 0===t.length?l:t.reduceRight(function(n,t){return function(e,r,o){return t(function(t,r){return n(e,t,r)},r,o)}})},h=(t.createFetch=function(){if(0===arguments.length)return p;var n=d.apply(void 0,arguments);return s(function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return n(e.fetch||fetch,t,e)})},t.init=function(n,t){return function(e,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return o[n]=t,e(r,o)}}),v=(t.method=function(n){return h("method",n)},function(n,t,e){(n.headers||(n.headers={}))[t]=e}),g=t.header=function(n,t){return function(e,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return v(o,n,t),e(r,o)}},y=(t.auth=function(n){return g("Authorization",n)},t.accept=function(n){return g("Accept",n)},t.base=function(n){return function(t,e,r){return t(n+(e||""),r)}},t.query=function(n){var t=c(n);return function(n,e,r){return n(e+(-1===e.indexOf("?")?"?":"&")+t,r)}}),b=t.body=function(n,t){return function(e,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return o.body=n,null!=n.length&&v(o,"Content-Length",(0,i["default"])(n)),t&&v(o,"Content-Type",t),e(r,o)}},j=(t.json=function(n){return b(f(n),"application/json")},t.params=function(n){var t=c(n);return function(n,e){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],o=(r.method||"GET").toUpperCase(),u="GET"===o||"HEAD"===o?y(t):b(t,"application/x-www-form-urlencoded");return u(n,e,r)}},t.onResponse=function(n){return function(t,e){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return(r.responseHandlers||(r.responseHandlers=[])).push(n),t(e,r)}});t.handleResponse=j,t.parseText=function(){var n=arguments.length<=0||void 0===arguments[0]?"textString":arguments[0];return j(function(t){return t.text().then(function(e){return t[n]=e,t})})},t.parseJSON=function(){var n=arguments.length<=0||void 0===arguments[0]?"jsonData":arguments[0];return j(function(t){return t.json().then(function(e){return t[n]=e,t},function(n){throw new Error("Error parsing JSON: "+n.stack)})})},t.requestInfo=function(){return function(n,t,e){return n(t,e).then(function(n){return n.requestInput=t,n.requestOptions=e,n},function(){var n=arguments.length<=0||void 0===arguments[0]?new Error:arguments[0];throw n.requestInput=t,n.requestOptions=e,n})}}},function(n,t){"use strict";n.exports=function(n){var t,e;if(!n)return 0;for(n=n.toString(),t=e=n.length;t--;){var r=n[t].charCodeAt();r>=56320&&57343>=r&&t--,r>127&&2047>=r?e++:r>2047&&65535>=r&&(e+=2)}return e}},function(n,t){"use strict";function e(n){if(null===n||void 0===n)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function r(){try{if(!Object.assign)return!1;var n=new String("abc");if(n[5]="de","5"===Object.getOwnPropertyNames(n)[0])return!1;for(var t={},e=0;10>e;e++)t["_"+String.fromCharCode(e)]=e;var r=Object.getOwnPropertyNames(t).map(function(n){return t[n]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(n){o[n]=n}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(u){return!1}}var o=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;n.exports=r()?Object.assign:function(n,t){for(var r,i,c=e(n),f=1;f<arguments.length;f++){r=Object(arguments[f]);for(var a in r)o.call(r,a)&&(c[a]=r[a]);if(Object.getOwnPropertySymbols){i=Object.getOwnPropertySymbols(r);for(var s=0;s<i.length;s++)u.call(r,i[s])&&(c[i[s]]=r[i[s]])}}return c}},function(n,t,e){"use strict";function r(n,t){return t.encode?t.strict?o(n):encodeURIComponent(n):n}var o=e(4),u=e(2);t.extract=function(n){return n.split("?")[1]||""},t.parse=function(n){var t=Object.create(null);return"string"!=typeof n?t:(n=n.trim().replace(/^(\?|#|&)/,""))?(n.split("&").forEach(function(n){var e=n.replace(/\+/g," ").split("="),r=e.shift(),o=e.length>0?e.join("="):void 0;r=decodeURIComponent(r),o=void 0===o?null:decodeURIComponent(o),void 0===t[r]?t[r]=o:Array.isArray(t[r])?t[r].push(o):t[r]=[t[r],o]}),t):t},t.stringify=function(n,t){var e={encode:!0,strict:!0};return t=u(e,t),n?Object.keys(n).sort().map(function(e){var o=n[e];if(void 0===o)return"";if(null===o)return e;if(Array.isArray(o)){var u=[];return o.slice().forEach(function(n){void 0!==n&&(null===n?u.push(r(e,t)):u.push(r(e,t)+"="+r(n,t)))}),u.join("&")}return r(e,t)+"="+r(o,t)}).filter(function(n){return n.length>0}).join("&"):""}},function(n,t){"use strict";n.exports=function(n){return encodeURIComponent(n).replace(/[!'()*]/g,function(n){return"%"+n.charCodeAt(0).toString(16).toUpperCase()})}}])}); | ||
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.HTTPClient=t():n.HTTPClient=t()}(this,function(){return function(n){function t(r){if(e[r])return e[r].exports;var o=e[r]={exports:{},id:r,loaded:!1};return n[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var e={};return t.m=n,t.c=e,t.p="",t(0)}([function(n,t,e){"use strict";function r(n){return n&&n.__esModule?n:{"default":n}}Object.defineProperty(t,"__esModule",{value:!0}),t.requestInfo=t.parseJSON=t.parseText=t.handleResponse=t.onResponse=t.params=t.json=t.body=t.query=t.base=t.accept=t.auth=t.header=t.method=t.init=t.createFetch=t.createStack=t.fetch=t.enhanceFetch=void 0;var o=e(3),u=e(1),i=r(u),c=fetch,f=function(n){return"string"==typeof n?n:(0,o.stringify)(n)},a=function(n){return"string"==typeof n?n:JSON.stringify(n)},s=function(n,t){return t.reduce(function(n,t){return n.then(t)},Promise.resolve(n))},p=t.enhanceFetch=function(n){return function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return n(t,e).then(function(n){var t=e.responseHandlers;return t&&t.length?s(n,t):n})}},l=p(c);t.fetch=l;var d=function(n,t,e){return n(t,e)},h=t.createStack=function(){for(var n=arguments.length,t=Array(n),e=0;e<n;e++)t[e]=arguments[e];return 0===t.length?d:t.reduceRight(function(n,t){return function(e,r,o){return t(function(t,r){return n(e,t,r)},r,o)}})},v=(t.createFetch=function(){if(0===arguments.length)return l;var n=h.apply(void 0,arguments);return p(function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return n(e.fetch||fetch,t,e)})},t.init=function(n,t){return function(e,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return o[n]=t,e(r,o)}}),g=(t.method=function(n){return v("method",n)},function(n,t,e){(n.headers||(n.headers={}))[t]=e}),y=t.header=function(n,t){return function(e,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return g(o,n,t),e(r,o)}},b=(t.auth=function(n){return y("Authorization",n)},t.accept=function(n){return y("Accept",n)},t.base=function(n){return function(t,e,r){return t(n+(e||""),r)}},t.query=function(n){var t=f(n);return function(n,e,r){return n(e+(e.indexOf("?")===-1?"?":"&")+t,r)}}),j=t.body=function(n,t){return function(e,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return o.body=n,null!=n.length&&g(o,"Content-Length",(0,i["default"])(n)),t&&g(o,"Content-Type",t),e(r,o)}},O=(t.json=function(n){return j(a(n),"application/json")},t.params=function(n){var t=f(n);return function(n,e){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],o=(r.method||"GET").toUpperCase(),u="GET"===o||"HEAD"===o?b(t):j(t,"application/x-www-form-urlencoded");return u(n,e,r)}},t.onResponse=function(n){return function(t,e){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return(r.responseHandlers||(r.responseHandlers=[])).push(n),t(e,r)}});t.handleResponse=O,t.parseText=function(){var n=arguments.length<=0||void 0===arguments[0]?"textString":arguments[0];return O(function(t){return t.text().then(function(e){return t[n]=e,t})})},t.parseJSON=function(){var n=arguments.length<=0||void 0===arguments[0]?"jsonData":arguments[0];return O(function(t){return t.json().then(function(e){return t[n]=e,t},function(n){throw new Error("Error parsing JSON: "+n.stack)})})},t.requestInfo=function(){return function(n,t,e){return n(t,e).then(function(n){return n.requestInput=t,n.requestOptions=e,n},function(){var n=arguments.length<=0||void 0===arguments[0]?new Error:arguments[0];throw n.requestInput=t,n.requestOptions=e,n})}}},function(n,t){"use strict";n.exports=function(n){var t,e;if(!n)return 0;for(n=n.toString(),t=e=n.length;t--;){var r=n[t].charCodeAt();56320<=r&&r<=57343&&t--,127<r&&r<=2047?e++:2047<r&&r<=65535&&(e+=2)}return e}},function(n,t){"use strict";function e(n){if(null===n||void 0===n)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function r(){try{if(!Object.assign)return!1;var n=new String("abc");if(n[5]="de","5"===Object.getOwnPropertyNames(n)[0])return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var r=Object.getOwnPropertyNames(t).map(function(n){return t[n]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(n){o[n]=n}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(u){return!1}}var o=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;n.exports=r()?Object.assign:function(n,t){for(var r,i,c=e(n),f=1;f<arguments.length;f++){r=Object(arguments[f]);for(var a in r)o.call(r,a)&&(c[a]=r[a]);if(Object.getOwnPropertySymbols){i=Object.getOwnPropertySymbols(r);for(var s=0;s<i.length;s++)u.call(r,i[s])&&(c[i[s]]=r[i[s]])}}return c}},function(n,t,e){"use strict";function r(n,t){return t.encode?t.strict?o(n):encodeURIComponent(n):n}var o=e(4),u=e(2);t.extract=function(n){return n.split("?")[1]||""},t.parse=function(n){var t=Object.create(null);return"string"!=typeof n?t:(n=n.trim().replace(/^(\?|#|&)/,""))?(n.split("&").forEach(function(n){var e=n.replace(/\+/g," ").split("="),r=e.shift(),o=e.length>0?e.join("="):void 0;r=decodeURIComponent(r),o=void 0===o?null:decodeURIComponent(o),void 0===t[r]?t[r]=o:Array.isArray(t[r])?t[r].push(o):t[r]=[t[r],o]}),t):t},t.stringify=function(n,t){var e={encode:!0,strict:!0};return t=u(e,t),n?Object.keys(n).sort().map(function(e){var o=n[e];if(void 0===o)return"";if(null===o)return r(e,t);if(Array.isArray(o)){var u=[];return o.slice().forEach(function(n){void 0!==n&&(null===n?u.push(r(e,t)):u.push(r(e,t)+"="+r(n,t)))}),u.join("&")}return r(e,t)+"="+r(o,t)}).filter(function(n){return n.length>0}).join("&"):""}},function(n,t){"use strict";n.exports=function(n){return encodeURIComponent(n).replace(/[!'()*]/g,function(n){return"%"+n.charCodeAt(0).toString(16).toUpperCase()})}}])}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
39973
6
653
0
275
1