interceptors: ClientRequestInterceptor incorrectly encodes basic authentication header
Our application uses Axios to send basic authentication requests to a 3rd party application. This integration works ok until we add the ClientRequestInterceptor (for logging purposes). The interceptor seems to apply url encoding when it should not.
Authorization header without interceptor (after base64 decoding): user@xyz.com:password
Authorization header with interceptor (after base64 decoding): user%40xyz.com:password
About this issue
- Original URL
- State: closed
- Created 2 months ago
- Reactions: 2
- Comments: 15 (15 by maintainers)
Released: v0.29.1 🎉
This has been released in v0.29.1!
Make sure to always update to the latest version (
npm i @mswjs/interceptors@latest
) to get the newest features and bug fixes.Predictable release automation by @ossjs/release.
I suspect this is due to Interceptor coercing your request options to a
URL
instance, which escapes the auth by default (which, per the RFC, seems like the right thing to do).Oh, that’s a huge oversight on my part! For some reason, I thought we are talking about the auth-in-URL (I think the username email threw me off). Let me give this test another try…
hi @kettanaito , thanks for the help (and for the great library 👍 ) we are using basic authentication as documented here