@@ -105,6 +105,11 @@ class RequestHandler {
105105
106106 if ( params . headers ) {
107107 this . _options . headers = new AxiosHeaders ( params . headers ) ;
108+
109+ const customCookies = this . _options . headers [ 'Cookie' ] ;
110+ if ( customCookies ) {
111+ this . _cookieJar . setCookieSync ( customCookies , this . _options . baseURL ) ;
112+ }
108113 }
109114
110115 this . _requestor = axios . create ( this . _options ) ;
@@ -130,13 +135,13 @@ class RequestHandler {
130135 */
131136 async get ( url : string , config ?: AxiosRequestConfig ) {
132137 return await this . sendRequestWithCookies ( url , async ( headersWithCookie ) =>
133- this . _requestor . get ( url , { ...config , headers : headersWithCookie } ) )
138+ this . _requestor . get ( url , { ...config , headers : headersWithCookie } ) , config ?. headers )
134139 . catch ( async ( err ) => {
135140 await this . _reauthenticate ( err ) ;
136141 return await this . sendRequestWithCookies ( url , ( headersWithCookie => this . _requestor . get ( url , {
137142 ...config ,
138143 headers : headersWithCookie
139- } ) ) ) ;
144+ } ) ) , config ?. headers ) ;
140145 } ) ;
141146 }
142147
@@ -150,13 +155,13 @@ class RequestHandler {
150155 */
151156 async delete ( url : string , config ?: AxiosRequestConfig ) {
152157 return await this . sendRequestWithCookies ( url , async ( headersWithCookie ) =>
153- this . _requestor . delete ( url , { ...config , headers : headersWithCookie } ) )
158+ this . _requestor . delete ( url , { ...config , headers : headersWithCookie } ) , config ?. headers )
154159 . catch ( async ( err ) => {
155160 await this . _reauthenticate ( err ) ;
156161 return this . sendRequestWithCookies ( url , ( headersWithCookie => this . _requestor . delete ( url , {
157162 ...config ,
158163 headers : headersWithCookie
159- } ) ) ) ;
164+ } ) ) , config ?. headers ) ;
160165 } ) ;
161166 }
162167
@@ -171,13 +176,13 @@ class RequestHandler {
171176 */
172177 async update ( url : string , body ?: object | string , config ?: AxiosRequestConfig ) {
173178 return await this . sendRequestWithCookies ( url , async ( headersWithCookie ) =>
174- this . _requestor . put ( url , body , { ...config , headers : headersWithCookie } ) )
179+ this . _requestor . put ( url , body , { ...config , headers : headersWithCookie } ) , config ?. headers )
175180 . catch ( async ( err ) => {
176181 await this . _reauthenticate ( err ) ;
177182 return this . sendRequestWithCookies ( url , ( headersWithCookie => this . _requestor . put ( url , body , {
178183 ...config ,
179184 headers : headersWithCookie
180- } ) ) ) ;
185+ } ) ) , config ?. headers ) ;
181186 } ) ;
182187 }
183188
@@ -192,13 +197,13 @@ class RequestHandler {
192197 */
193198 async create ( url : string , body ?: object | string , config ?: AxiosRequestConfig ) {
194199 return await this . sendRequestWithCookies ( url , async ( headersWithCookie ) =>
195- this . _requestor . post ( url , body , { ...config , headers : headersWithCookie } ) )
200+ this . _requestor . post ( url , body , { ...config , headers : headersWithCookie } ) , config ?. headers )
196201 . catch ( async ( err ) => {
197202 await this . _reauthenticate ( err ) ;
198203 return this . sendRequestWithCookies ( url , ( headersWithCookie => this . _requestor . post ( url , body , {
199204 ...config ,
200205 headers : headersWithCookie
201- } ) ) ) ;
206+ } ) ) , config ?. headers ) ;
202207 } ) ;
203208
204209 }
@@ -278,7 +283,7 @@ class RequestHandler {
278283 headers : { 'content-type' : 'application/octet-stream' } ,
279284 } ;
280285
281- const configHeaders = config === undefined ? undefined : config . headers ;
286+ const configHeaders = config ? .headers ;
282287 const requestHeaders = { ...configHeaders , ...attachmentConfig . headers } ;
283288
284289 return await this . sendRequestWithCookies ( url , async ( headersWithCookie ) =>
0 commit comments