Skip to content

Commit 4d97317

Browse files
authored
added missing headers (#47)
1 parent 4c01176 commit 4d97317

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

examples/react-app/request.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,20 @@ export const request = <T>(
4949
return new CancelablePromise((resolve, reject, onCancel) => {
5050
onCancel(() => source.cancel("The user aborted a request."));
5151

52+
let formattedHeaders = options.headers;
53+
if(options.mediaType) {
54+
formattedHeaders = {
55+
...options.headers,
56+
"Content-Type": options.mediaType,
57+
};
58+
}
59+
5260
return axiosInstance
5361
.request({
5462
url: options.url,
5563
data: options.body,
5664
method: options.method,
65+
headers: formattedHeaders,
5766
cancelToken: source.token,
5867
})
5968
.then((res) => {

0 commit comments

Comments
 (0)