This sets a default Axios interceptor, from now on any Axios errors will use errorInterceptor which transforms the usual Axios error that has fields like error.request.method into this new (custom?) format that has fields like error.req.method
This is confusing and unexpected; I would expect FireBlocks to decorate their own Axios instance as they desire, but leave all other Axios instances alone.
To Reproduce
import { FireblocksSDK } from 'fireblocks-sdk';
import * as axios from 'axios';
new FireblocksSDK("Some secret", "API key");
// Expect: 0
// Actual: 1
console.log(axios.default.interceptors.response.handlers.length);
Expected behavior
No default interceptors should be registered; these interceptors should only be registered on the FireBlocks-SDK-internal axios instance
Consider moving to something other than @notabene/pii-sdk or fixing @notabene/pii-sdk to allow adding interceptors only to certain specific Axios instances
Describe the bug If you import the FireBlocks SDK it in turn imports:
(See
pii-client.d.ts
)This in turn runs the following code:
This sets a default Axios interceptor, from now on any Axios errors will use
errorInterceptor
which transforms the usual Axios error that has fields likeerror.request.method
into this new (custom?) format that has fields likeerror.req.method
This is confusing and unexpected; I would expect FireBlocks to decorate their own Axios instance as they desire, but leave all other Axios instances alone.
To Reproduce
Expected behavior No default interceptors should be registered; these interceptors should only be registered on the FireBlocks-SDK-internal axios instance
Version:
fireblocks-sdk
version: 5.33.0