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

axios-middleware

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-middleware - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

48

dist/axios-middleware.common.js
/**
* axios-middleware v0.2.1
* axios-middleware v0.3.0
* (c) 2018 Émile Bergeron

@@ -8,44 +8,3 @@ * @license MIT

/* eslint-disable class-methods-use-this, no-unused-vars */
/**
* Default middleware implementation. Extend this class to create a custom middleware.
*/
var HttpMiddleware = function HttpMiddleware () {};
HttpMiddleware.prototype.onRequest = function onRequest (config) {
return config;
};
/**
* Default implementation is a noop.
* @param {Object} error
*/
HttpMiddleware.prototype.onRequestError = function onRequestError (error) { };
/**
* Default implementation is the identity function.
* @param {Promise} promise
* @returns {Promise}
*/
HttpMiddleware.prototype.onSync = function onSync (promise) {
return promise;
};
/**
* Default implementation is the identity function.
* @param {Object} response
* @returns {Object}
*/
HttpMiddleware.prototype.onResponse = function onResponse (response) {
return response;
};
/**
* Default implementation is a noop.
* @param {Object} error
*/
HttpMiddleware.prototype.onResponseError = function onResponseError (error) { };
/**
* @property {Array} middlewares stack

@@ -186,7 +145,6 @@ * @property {AxiosInstance} http

var index = {
HttpMiddleware: HttpMiddleware,
HttpMiddlewareService: HttpMiddlewareService,
version: '0.2.1',
Service: HttpMiddlewareService,
version: '0.3.0',
};
module.exports = index;
/**
* axios-middleware v0.2.1
* axios-middleware v0.3.0
* (c) 2018 Émile Bergeron
* @license MIT
*/
/* eslint-disable class-methods-use-this, no-unused-vars */
/**
* Default middleware implementation. Extend this class to create a custom middleware.
*/
var HttpMiddleware = function HttpMiddleware () {};
HttpMiddleware.prototype.onRequest = function onRequest (config) {
return config;
};
/**
* Default implementation is a noop.
* @param {Object} error
*/
HttpMiddleware.prototype.onRequestError = function onRequestError (error) { };
/**
* Default implementation is the identity function.
* @param {Promise} promise
* @returns {Promise}
*/
HttpMiddleware.prototype.onSync = function onSync (promise) {
return promise;
};
/**
* Default implementation is the identity function.
* @param {Object} response
* @returns {Object}
*/
HttpMiddleware.prototype.onResponse = function onResponse (response) {
return response;
};
/**
* Default implementation is a noop.
* @param {Object} error
*/
HttpMiddleware.prototype.onResponseError = function onResponseError (error) { };
/**
* @property {Array} middlewares stack

@@ -183,8 +142,7 @@ * @property {AxiosInstance} http

var index_esm = {
HttpMiddleware: HttpMiddleware,
HttpMiddlewareService: HttpMiddlewareService,
version: '0.2.1',
Service: HttpMiddlewareService,
version: '0.3.0',
};
export default index_esm;
export { HttpMiddleware, HttpMiddlewareService };
export { HttpMiddlewareService as Service };
/**
* axios-middleware v0.2.1
* axios-middleware v0.3.0
* (c) 2018 Émile Bergeron

@@ -12,44 +12,3 @@ * @license MIT

/* eslint-disable class-methods-use-this, no-unused-vars */
/**
* Default middleware implementation. Extend this class to create a custom middleware.
*/
var HttpMiddleware = function HttpMiddleware () {};
HttpMiddleware.prototype.onRequest = function onRequest (config) {
return config;
};
/**
* Default implementation is a noop.
* @param {Object} error
*/
HttpMiddleware.prototype.onRequestError = function onRequestError (error) { };
/**
* Default implementation is the identity function.
* @param {Promise} promise
* @returns {Promise}
*/
HttpMiddleware.prototype.onSync = function onSync (promise) {
return promise;
};
/**
* Default implementation is the identity function.
* @param {Object} response
* @returns {Object}
*/
HttpMiddleware.prototype.onResponse = function onResponse (response) {
return response;
};
/**
* Default implementation is a noop.
* @param {Object} error
*/
HttpMiddleware.prototype.onResponseError = function onResponseError (error) { };
/**
* @property {Array} middlewares stack

@@ -190,5 +149,4 @@ * @property {AxiosInstance} http

var index = {
HttpMiddleware: HttpMiddleware,
HttpMiddlewareService: HttpMiddlewareService,
version: '0.2.1',
Service: HttpMiddlewareService,
version: '0.3.0',
};

@@ -195,0 +153,0 @@

4

dist/axios-middleware.min.js
/**
* axios-middleware v0.2.1
* axios-middleware v0.3.0
* (c) 2018 Émile Bergeron
* @license MIT
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.AxiosMiddleware=e()}(this,function(){"use strict";var t=function(){};t.prototype.onRequest=function(t){return t},t.prototype.onRequestError=function(t){},t.prototype.onSync=function(t){return t},t.prototype.onResponse=function(t){return t},t.prototype.onResponseError=function(t){};var e=function(t){this.middlewares=[],this.setHttp(t)};return e.prototype.setHttp=function(t){var e=this;return this.unsetHttp(),t&&(this.http=t,this.originalAdapter=t.defaults.adapter,t.defaults.adapter=function(t){return e.adapter(t)}),this},e.prototype.unsetHttp=function(){return this.http&&(this.http.defaults.adapter=this.originalAdapter,this.http=null),this},e.prototype.has=function(t){return-1<this.middlewares.indexOf(t)},e.prototype.register=function(t){var e=this;return Array.isArray(t)||(t=[t]),t.forEach(function(t){if(e.has(t))throw new Error("Middleware already registered");e.middlewares.push(t)}),this},e.prototype.unregister=function(t){var e=this.middlewares.indexOf(t);return-1<e&&this.middlewares.splice(e,1),this},e.prototype.reset=function(){return this.middlewares.length=0,this},e.prototype.adapter=function(t){var e=this,r=[function(t){return e._onSync(e.originalAdapter.call(e.http,t))},void 0],n=Promise.resolve(t);for(this.middlewares.forEach(function(e){r.unshift(e.onRequest&&function(t){return e.onRequest(t)},e.onRequestError&&function(t){return e.onRequestError(t)})}),this.middlewares.forEach(function(e){r.push(e.onResponse&&function(t){return e.onResponse(t)},e.onResponseError&&function(t){return e.onResponseError(t)})});r.length;)n=n.then(r.shift(),r.shift());return n},e.prototype._onSync=function(t){return this.middlewares.reduce(function(t,e){return e.onSync?e.onSync(t):t},t)},{HttpMiddleware:t,HttpMiddlewareService:e,version:"0.2.1"}});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.AxiosMiddleware=e()}(this,function(){"use strict";var t=function(t){this.middlewares=[],this.setHttp(t)};return t.prototype.setHttp=function(t){var e=this;return this.unsetHttp(),t&&(this.http=t,this.originalAdapter=t.defaults.adapter,t.defaults.adapter=function(t){return e.adapter(t)}),this},t.prototype.unsetHttp=function(){return this.http&&(this.http.defaults.adapter=this.originalAdapter,this.http=null),this},t.prototype.has=function(t){return-1<this.middlewares.indexOf(t)},t.prototype.register=function(t){var e=this;return Array.isArray(t)||(t=[t]),t.forEach(function(t){if(e.has(t))throw new Error("Middleware already registered");e.middlewares.push(t)}),this},t.prototype.unregister=function(t){var e=this.middlewares.indexOf(t);return-1<e&&this.middlewares.splice(e,1),this},t.prototype.reset=function(){return this.middlewares.length=0,this},t.prototype.adapter=function(t){var e=this,r=[function(t){return e._onSync(e.originalAdapter.call(e.http,t))},void 0],n=Promise.resolve(t);for(this.middlewares.forEach(function(e){r.unshift(e.onRequest&&function(t){return e.onRequest(t)},e.onRequestError&&function(t){return e.onRequestError(t)})}),this.middlewares.forEach(function(e){r.push(e.onResponse&&function(t){return e.onResponse(t)},e.onResponseError&&function(t){return e.onResponseError(t)})});r.length;)n=n.then(r.shift(),r.shift());return n},t.prototype._onSync=function(t){return this.middlewares.reduce(function(t,e){return e.onSync?e.onSync(t):t},t)},{Service:t,version:"0.3.0"}});
{
"name": "axios-middleware",
"version": "0.2.1",
"version": "0.3.0",
"description": "Simple axios HTTP middleware service",

@@ -5,0 +5,0 @@ "author": "Emile Bergeron <ber.emile@prismalstudio.com>",

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