request intercepters order is reversed
See original GitHub issueconst axios = require('axios');
axios.interceptors.request.use(function(config) {
console.log(1);
}, undefined);
axios.interceptors.request.use(function(config) {
console.log(2);
}, undefined);
axios.get('http://www.baidu.com').then(function() {
console.log('ok');
}).catch(function() {
console.log('fail');
});
which prints:
node index.js
2
1
fail
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:25 (6 by maintainers)
Top Results From Across the Web
Order of applying request interceptors is reversed. #841 - GitHub
I've encountered a bug(or a feature) that my request interceptors were applied in reversed order. This is the culprit:
Read more >What is the order of execution of $http interceptors in ...
It seems that the interceptors are executed: in registration order for requests; in reverse registration order for responses.
Read more >Interceptors class - dio library - Dart API - Pub.dev
API docs for the Interceptors class from the dio library, ... reversed → Iterable<Interceptor>: An Iterable of the objects in this list in...
Read more >OkHttp Logging and Order of Interceptors | by Herman Cheung
We may intercept the HTTP requests and responses, modify them. ... level interceptor, and the order to get the HTTP response is reversed....
Read more >Introduction to CORBA Request-Level Interceptors
A request-level interceptor is a user-written CORBA object that provides a means to ... a response in the reverse order than that of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
anyone here to see this problem?
/* Edited: I had forgotten to pipe the handlers */
Well, I’ve used a different aproach. First off, I’ve defined an Object called InterceptionHandler. I also have defined a pipe function to chain the handlers
So, the ideia is create multiple handlers, and use them in a single pair of interceptors.
After that we can line up the handlers in an appropriate execution order.
Which produces the output