Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
"lodash.flatmap": "^4.5.0",
"tiny-warning": "^1.0.3"
},
"jest": {
"moduleNameMapper": {
"axios": "axios/dist/node/axios.cjs"
}
},
"bugs": {
"email": "support@bandwidth.com"
}
Expand Down
12 changes: 6 additions & 6 deletions src/http/httpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
*/

import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import axios, { AxiosHeaders, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import isNode from 'detect-node';
import FormData from 'form-data';
import { isBlob } from '../apiHelper';
Expand Down Expand Up @@ -91,14 +91,14 @@
}

newRequest.data = form;
mergeHeaders(newRequest.headers || {} , form.getHeaders());
mergeHeaders(newRequest.headers as AxiosHeaders || {} , form.getHeaders());
} else if (
requestBody?.type === 'form-data' ||
requestBody?.type === 'form'
) {
// Create form-urlencoded request
setHeader(
newRequest.headers || {},
newRequest.headers as AxiosHeaders || {},
CONTENT_TYPE_HEADER,
FORM_URLENCODED_CONTENT_TYPE
);
Expand All @@ -112,7 +112,7 @@
// Otherwise, use the content type if available.
contentType = requestBody.content.options.contentType;
}
setHeaderIfNotSet(newRequest.headers || {}, CONTENT_TYPE_HEADER, contentType);
setHeaderIfNotSet(newRequest.headers as AxiosHeaders || {}, CONTENT_TYPE_HEADER, contentType);
newRequest.data = requestBody.content.file;
}
else if (requestBody && typeof(requestBody['type']) !== 'undefined') {
Expand All @@ -139,7 +139,7 @@
public convertHttpResponse(resp: AxiosResponse): HttpResponse {
return {
body: resp.data,
headers: resp.headers,
headers: resp.headers as AxiosHeaders,
statusCode: resp.status,
};
}
Expand Down Expand Up @@ -185,4 +185,4 @@
return new AbortError('The HTTP call was aborted.');
}
}