File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 22 createAuthHeaderGenerator ,
33 AuthHeaderConfig ,
44} from '@ordermentum/asap-core' ;
5- import axios , { AxiosInstance , AxiosRequestConfig } from 'axios' ;
5+ import axios , { AxiosInstance , AxiosRequestConfig , AxiosHeaders } from 'axios' ;
66import http from 'http' ;
77import https from 'https' ;
88
@@ -12,9 +12,13 @@ export const createAsapInterceptor = (authConfig: AuthHeaderConfig) => {
1212 } ) ;
1313 return ( config : AxiosRequestConfig ) => {
1414 const header = headerGenerator ( ) ;
15- const headers = config . headers ?? { } ;
16- headers . Authorization = header ;
17- return { ...config , headers } ;
15+ // @ts -expect-error RawAxiosHeaders is not accessible for type defs
16+ const headers : AxiosHeaders = new AxiosHeaders ( config . headers ?? { } ) ;
17+ headers . set ( 'Authorization' , header ) ;
18+ return {
19+ ...config ,
20+ headers,
21+ } ;
1822 } ;
1923} ;
2024
You can’t perform that action at this time.
0 commit comments