@@ -110,7 +110,7 @@ export class HttpClient {
110
110
options : SendRequestOptions ,
111
111
) : AxiosRequestConfig {
112
112
const headers = Object . assign ( { } , this . headers , options . headers ) ;
113
- console . log ( `isDeepL: ${ isDeepL } ` ) ;
113
+ logDebug ( `isDeepL: ${ isDeepL } ` ) ;
114
114
115
115
const axiosRequestConfig : AxiosRequestConfig = {
116
116
url : isDeepL ? url : undefined ,
@@ -152,7 +152,7 @@ export class HttpClient {
152
152
* @param url Path to endpoint, excluding base server URL if DeepL API request, including base server URL if a webpage.
153
153
* @param options Additional options controlling request.
154
154
* @param responseAsStream Set to true if the return type is IncomingMessage.
155
- * @return Fulfills with status code and response (as text or stream).
155
+ * @return Fulfills with status code, content type, and response (as text or stream).
156
156
*/
157
157
async sendRequestWithBackoff < TContent extends string | IncomingMessage > (
158
158
method : HttpMethod ,
@@ -182,6 +182,11 @@ export class HttpClient {
182
182
isDeepLUrl ,
183
183
options ,
184
184
) ;
185
+
186
+ if ( ! isDeepLUrl && axiosRequestConfig . headers ) {
187
+ delete axiosRequestConfig . headers . Authorization ;
188
+ }
189
+
185
190
try {
186
191
response = await HttpClient . sendAxiosRequest < TContent > ( axiosRequestConfig ) ;
187
192
error = undefined ;
@@ -251,7 +256,11 @@ export class HttpClient {
251
256
}
252
257
}
253
258
254
- return { statusCode : response . status , content : response . data , contentType } ;
259
+ return {
260
+ statusCode : response . status ,
261
+ content : response . data ,
262
+ contentType : contentType ,
263
+ } ;
255
264
} catch ( axios_error_raw ) {
256
265
const axiosError = axios_error_raw as AxiosError ;
257
266
const message : string = axiosError . message || '' ;
0 commit comments