Instantiates the SDK with additional interceptors.
It doesn't override the existing interceptors, but instead push more to the list. This method should be used in conjunction with the initializer createAdvancedClient.
createAdvancedClient
withAdditionalInterceptors([ { request: ({ request }) => { console.log(`Do something with ${JSON.stringify(request)}`) return request }, response: ({ response }) => { console.log(`Do something with ${JSON.stringify(response)}`) return response }, responseError: async ({ request, error, }: { request: Request error: unknown }) => { console.log( `Do something with ${JSON.stringify(request)} and ${JSON.stringify( error, )}`, ) throw error // or return Promise.resolve(someData) }, },]) Copy
withAdditionalInterceptors([ { request: ({ request }) => { console.log(`Do something with ${JSON.stringify(request)}`) return request }, response: ({ response }) => { console.log(`Do something with ${JSON.stringify(response)}`) return response }, responseError: async ({ request, error, }: { request: Request error: unknown }) => { console.log( `Do something with ${JSON.stringify(request)} and ${JSON.stringify( error, )}`, ) throw error // or return Promise.resolve(someData) }, },])
The additional NetworkInterceptors interceptors
A factory ClientConfig
Instantiates the SDK with additional interceptors.
Remarks
It doesn't override the existing interceptors, but instead push more to the list. This method should be used in conjunction with the initializer
createAdvancedClient
.Example