Skip to content

Commit

Permalink
Incorporate PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
SleeplessOne1917 committed Jul 8, 2023
1 parent d2644e2 commit ba6d044
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ba6d044

Please sign in to comment.