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

@commercetools/sdk-middleware-http

Package Overview
Dependencies
Maintainers
2
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools/sdk-middleware-http - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

9

CHANGELOG.md

@@ -1,10 +0,5 @@

<a name="1.1.1"></a>
## 1.1.1 (2017-01-26)
<a name="2.0.0"></a>
# 2.0.0 (2017-01-28)
### Bug Fixes
* **middleware-http:** allow call without parameters ([0d4ca26](https://github.com/commercetools/nodejs/commit/0d4ca26))
### Features

@@ -11,0 +6,0 @@

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

!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.CommercetoolsSdkMiddlewareHttp=r():t.CommercetoolsSdkMiddlewareHttp=r()}(this,function(){return function(t){function r(n){if(e[n])return e[n].exports;var o=e[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}var e={};return r.m=t,r.c=e,r.p="",r(0)}([function(t,r,e){"use strict";function n(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r}function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,"__esModule",{value:!0}),r.errors=r.getErrorByCode=r.createHttpMiddleware=void 0;var i=e(2);Object.defineProperty(r,"createHttpMiddleware",{enumerable:!0,get:function(){return o(i).default}});var s=e(1);Object.defineProperty(r,"getErrorByCode",{enumerable:!0,get:function(){return o(s).default}});var a=n(s);r.errors=a},function(t,r){"use strict";function e(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.status=this.statusCode=this.code=t,this.message=r,Object.assign(this,e),this.name=this.constructor.name,this.constructor.prototype.__proto__=Error.prototype,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}function n(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,0].concat(r))}function o(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this].concat(r))}function i(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,400].concat(r))}function s(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,401].concat(r))}function a(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,403].concat(r))}function u(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,404].concat(r))}function f(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,409].concat(r))}function h(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,500].concat(r))}function c(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,503].concat(r))}function l(t){switch(t){case 0:return n;case 400:return i;case 401:return s;case 403:return a;case 404:return u;case 409:return f;case 500:return h;case 503:return c;default:return}}Object.defineProperty(r,"__esModule",{value:!0}),r.NetworkError=n,r.HttpError=o,r.BadRequest=i,r.Unauthorized=s,r.Forbidden=a,r.NotFound=u,r.ConcurrentModification=f,r.InternalServerError=h,r.ServiceUnavailable=c,r.default=l},function(t,r,e){(function(t){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,r){var e={};for(var n in t)r.indexOf(n)<0&&Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function i(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=r.host,n=void 0===e?l:e;return function(r){return function(e,o){var i=n+e.uri,u="string"==typeof e.body?e.body:JSON.stringify(e.body);fetch(i,a({method:e.method,headers:a({"Content-Type":"application/json"},e.headers,u?{"Content-Length":""+t.byteLength(u)}:{})},u?{body:u}:{})).then(function(t){return t.ok?void t.json().then(function(n){var i=a({},o,{body:n,statusCode:t.status});r(e,i)}):void t.text().then(function(n){var i=void 0;try{i=JSON.parse(n)}catch(t){}var u=s(a({statusCode:t.status,originalRequest:e,headers:(0,f.default)(t.headers)},i?{message:i.message,body:i}:{})),h=a({},o,{error:u,statusCode:t.status});r(e,h)})},function(t){var n=new h.NetworkError(t.message,{originalRequest:e});r(e,a({},o,{error:n,statusCode:0}))})}}}function s(t){var r=t.statusCode,e=t.message,n=o(t,["statusCode","message"]),i=e||"Unexpected non-JSON error response";404===r&&(i="URI not found: "+n.originalRequest.uri);var s=(0,c.default)(r);return s?new s(i,n):new h.HttpError(r,i,n)}Object.defineProperty(r,"__esModule",{value:!0});var a=Object.assign||function(t){for(var r=1;arguments.length>r;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t};r.default=i,e(8);var u=e(3),f=n(u),h=e(1),c=n(h),l="https://api.sphere.io"}).call(r,e(5).Buffer)},function(t,r){"use strict";function e(t){if(t.raw)return t.raw();if(!t.forEach)return{};var r={};return t.forEach(function(t,e){r[e]=t}),r}Object.defineProperty(r,"__esModule",{value:!0}),r.default=e},function(t,r){"use strict";function e(t){var r=t.length;if(r%4>0)throw Error("Invalid string. Length must be a multiple of 4");return"="===t[r-2]?2:"="===t[r-1]?1:0}function n(t){return 3*t.length/4-e(t)}function o(t){var r,n,o,i,s,a,u=t.length;s=e(t),a=new h(3*u/4-s),o=s>0?u-4:u;var c=0;for(r=0,n=0;o>r;r+=4,n+=3)i=f[t.charCodeAt(r)]<<18|f[t.charCodeAt(r+1)]<<12|f[t.charCodeAt(r+2)]<<6|f[t.charCodeAt(r+3)],a[c++]=i>>16&255,a[c++]=i>>8&255,a[c++]=255&i;return 2===s?(i=f[t.charCodeAt(r)]<<2|f[t.charCodeAt(r+1)]>>4,a[c++]=255&i):1===s&&(i=f[t.charCodeAt(r)]<<10|f[t.charCodeAt(r+1)]<<4|f[t.charCodeAt(r+2)]>>2,a[c++]=i>>8&255,a[c++]=255&i),a}function i(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,r,e){for(var n,o=[],s=r;e>s;s+=3)n=(t[s]<<16)+(t[s+1]<<8)+t[s+2],o.push(i(n));return o.join("")}function a(t){for(var r,e=t.length,n=e%3,o="",i=[],a=16383,f=0,h=e-n;h>f;f+=a)i.push(s(t,f,f+a>h?h:f+a));return 1===n?(r=t[e-1],o+=u[r>>2],o+=u[r<<4&63],o+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],o+=u[r>>10],o+=u[r>>4&63],o+=u[r<<2&63],o+="="),i.push(o),i.join("")}r.byteLength=n,r.toByteArray=o,r.fromByteArray=a;for(var u=[],f=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,p=c.length;p>l;++l)u[l]=c[l],f[c.charCodeAt(l)]=l;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63},function(t,r,e){(function(t){/*!
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.CommercetoolsSdkMiddlewareHttp=r():t.CommercetoolsSdkMiddlewareHttp=r()}(this,function(){return function(t){function r(n){if(e[n])return e[n].exports;var o=e[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}var e={};return r.m=t,r.c=e,r.p="",r(0)}([function(t,r,e){"use strict";function n(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r}function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(r,"__esModule",{value:!0}),r.errors=r.getErrorByCode=r.createHttpMiddleware=void 0;var i=e(2);Object.defineProperty(r,"createHttpMiddleware",{enumerable:!0,get:function(){return o(i).default}});var s=e(1);Object.defineProperty(r,"getErrorByCode",{enumerable:!0,get:function(){return o(s).default}});var a=n(s);r.errors=a},function(t,r){"use strict";function e(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.status=this.statusCode=this.code=t,this.message=r,Object.assign(this,e),this.name=this.constructor.name,this.constructor.prototype.__proto__=Error.prototype,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}function n(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,0].concat(r))}function o(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this].concat(r))}function i(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,400].concat(r))}function s(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,401].concat(r))}function a(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,403].concat(r))}function u(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,404].concat(r))}function f(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,409].concat(r))}function h(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,500].concat(r))}function c(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];e.call.apply(e,[this,503].concat(r))}function l(t){switch(t){case 0:return n;case 400:return i;case 401:return s;case 403:return a;case 404:return u;case 409:return f;case 500:return h;case 503:return c;default:return}}Object.defineProperty(r,"__esModule",{value:!0}),r.NetworkError=n,r.HttpError=o,r.BadRequest=i,r.Unauthorized=s,r.Forbidden=a,r.NotFound=u,r.ConcurrentModification=f,r.InternalServerError=h,r.ServiceUnavailable=c,r.default=l},function(t,r,e){(function(t){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,r){var e={};for(var n in t)r.indexOf(n)<0&&Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function i(r){return function(e){return function(n,o){var i=r.host+n.uri,u="string"==typeof n.body?n.body:JSON.stringify(n.body);fetch(i,a({method:n.method,headers:a({"Content-Type":"application/json"},n.headers,u?{"Content-Length":""+t.byteLength(u)}:{})},u?{body:u}:{})).then(function(t){return t.ok?void t.json().then(function(r){var i=a({},o,{body:r,statusCode:t.status});e(n,i)}):void t.text().then(function(r){var i=void 0;try{i=JSON.parse(r)}catch(t){}var u=s(a({statusCode:t.status,originalRequest:n,headers:(0,f.default)(t.headers)},i?{message:i.message,body:i}:{})),h=a({},o,{error:u,statusCode:t.status});e(n,h)})},function(t){var r=new h.NetworkError(t.message,{originalRequest:n});e(n,a({},o,{error:r,statusCode:0}))})}}}function s(t){var r=t.statusCode,e=t.message,n=o(t,["statusCode","message"]),i=e||"Unexpected non-JSON error response";404===r&&(i="URI not found: "+n.originalRequest.uri);var s=(0,c.default)(r);return s?new s(i,n):new h.HttpError(r,i,n)}Object.defineProperty(r,"__esModule",{value:!0});var a=Object.assign||function(t){for(var r=1;arguments.length>r;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t};r.default=i,e(8);var u=e(3),f=n(u),h=e(1),c=n(h)}).call(r,e(5).Buffer)},function(t,r){"use strict";function e(t){if(t.raw)return t.raw();if(!t.forEach)return{};var r={};return t.forEach(function(t,e){r[e]=t}),r}Object.defineProperty(r,"__esModule",{value:!0}),r.default=e},function(t,r){"use strict";function e(t){var r=t.length;if(r%4>0)throw Error("Invalid string. Length must be a multiple of 4");return"="===t[r-2]?2:"="===t[r-1]?1:0}function n(t){return 3*t.length/4-e(t)}function o(t){var r,n,o,i,s,a,u=t.length;s=e(t),a=new h(3*u/4-s),o=s>0?u-4:u;var c=0;for(r=0,n=0;o>r;r+=4,n+=3)i=f[t.charCodeAt(r)]<<18|f[t.charCodeAt(r+1)]<<12|f[t.charCodeAt(r+2)]<<6|f[t.charCodeAt(r+3)],a[c++]=i>>16&255,a[c++]=i>>8&255,a[c++]=255&i;return 2===s?(i=f[t.charCodeAt(r)]<<2|f[t.charCodeAt(r+1)]>>4,a[c++]=255&i):1===s&&(i=f[t.charCodeAt(r)]<<10|f[t.charCodeAt(r+1)]<<4|f[t.charCodeAt(r+2)]>>2,a[c++]=i>>8&255,a[c++]=255&i),a}function i(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,r,e){for(var n,o=[],s=r;e>s;s+=3)n=(t[s]<<16)+(t[s+1]<<8)+t[s+2],o.push(i(n));return o.join("")}function a(t){for(var r,e=t.length,n=e%3,o="",i=[],a=16383,f=0,h=e-n;h>f;f+=a)i.push(s(t,f,f+a>h?h:f+a));return 1===n?(r=t[e-1],o+=u[r>>2],o+=u[r<<4&63],o+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],o+=u[r>>10],o+=u[r>>4&63],o+=u[r<<2&63],o+="="),i.push(o),i.join("")}r.byteLength=n,r.toByteArray=o,r.fromByteArray=a;for(var u=[],f=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,p=c.length;p>l;++l)u[l]=c[l],f[c.charCodeAt(l)]=l;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63},function(t,r,e){(function(t){/*!
* The buffer module from node.js, for the browser.

@@ -3,0 +3,0 @@ *

@@ -28,12 +28,6 @@ 'use strict';

var defaultApiHost = 'https://api.sphere.io';
function createHttpMiddleware() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$host = _ref.host,
host = _ref$host === undefined ? defaultApiHost : _ref$host;
function createHttpMiddleware(options) {
return function (next) {
return function (request, response) {
var url = host + request.uri;
var url = options.host + request.uri;
var body = typeof request.body === 'string' ? request.body : JSON.stringify(request.body);

@@ -91,6 +85,6 @@

function createError(_ref2) {
var statusCode = _ref2.statusCode,
message = _ref2.message,
rest = _objectWithoutProperties(_ref2, ['statusCode', 'message']);
function createError(_ref) {
var statusCode = _ref.statusCode,
message = _ref.message,
rest = _objectWithoutProperties(_ref, ['statusCode', 'message']);

@@ -97,0 +91,0 @@ var errorMessage = message || 'Unexpected non-JSON error response';

@@ -7,3 +7,3 @@ {

"name": "@commercetools/sdk-middleware-http",
"version": "1.1.1",
"version": "2.0.0",
"description": "Middleware for http requests, to use with @commercetools/sdk-client",

@@ -10,0 +10,0 @@ "keywords": [

Sorry, the diff of this file is too big to display

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