@@ -110,7 +110,7 @@ export class HttpClient {
110110 options : SendRequestOptions ,
111111 ) : AxiosRequestConfig {
112112 const headers = Object . assign ( { } , this . headers , options . headers ) ;
113- console . log ( `isDeepL: ${ isDeepL } ` ) ;
113+ logDebug ( `isDeepL: ${ isDeepL } ` ) ;
114114
115115 const axiosRequestConfig : AxiosRequestConfig = {
116116 url : isDeepL ? url : undefined ,
@@ -152,7 +152,7 @@ export class HttpClient {
152152 * @param url Path to endpoint, excluding base server URL if DeepL API request, including base server URL if a webpage.
153153 * @param options Additional options controlling request.
154154 * @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).
156156 */
157157 async sendRequestWithBackoff < TContent extends string | IncomingMessage > (
158158 method : HttpMethod ,
@@ -182,6 +182,11 @@ export class HttpClient {
182182 isDeepLUrl ,
183183 options ,
184184 ) ;
185+
186+ if ( ! isDeepLUrl && axiosRequestConfig . headers ) {
187+ delete axiosRequestConfig . headers . Authorization ;
188+ }
189+
185190 try {
186191 response = await HttpClient . sendAxiosRequest < TContent > ( axiosRequestConfig ) ;
187192 error = undefined ;
@@ -251,7 +256,11 @@ export class HttpClient {
251256 }
252257 }
253258
254- return { statusCode : response . status , content : response . data , contentType } ;
259+ return {
260+ statusCode : response . status ,
261+ content : response . data ,
262+ contentType : contentType ,
263+ } ;
255264 } catch ( axios_error_raw ) {
256265 const axiosError = axios_error_raw as AxiosError ;
257266 const message : string = axiosError . message || '' ;
0 commit comments