From ba6d0442d89cbcee544537a533c393629ac89762 Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 Date: Sat, 8 Jul 2023 01:13:41 -0400 Subject: [PATCH] Incorporate PR feedback --- src/client.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/client.ts b/src/client.ts index 1661791..1073dce 100644 --- a/src/client.ts +++ b/src/client.ts @@ -113,9 +113,9 @@ export class HttpClient { logDebug(`isDeepL: ${isDeepL}`); const axiosRequestConfig: AxiosRequestConfig = { - url: isDeepL ? url : undefined, + url, method, - baseURL: isDeepL ? this.serverUrl : url, + baseURL: isDeepL ? this.serverUrl : undefined, headers, responseType: responseAsStream ? 'stream' : 'text', timeout: timeoutMs, @@ -247,19 +247,10 @@ export class HttpClient { } } - let contentType: string | undefined = undefined; - if (response.headers.getContentType) { - if (typeof response.headers.getContentType === 'string') { - contentType = response.headers.getContentType; - } else { - contentType = response.headers.getContentType()?.toString() ?? undefined; - } - } - return { statusCode: response.status, content: response.data, - contentType: contentType, + contentType: response.headers['content-type'], }; } catch (axios_error_raw) { const axiosError = axios_error_raw as AxiosError;