File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed
Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -89,10 +89,6 @@ export const fetchToAxiosConfig = (
8989export function axiosToFetchResponse ( axiosRes : AxiosResponse ) : Response {
9090 const { data, status, statusText, config } = axiosRes ;
9191
92- const headersObj = Object . fromEntries (
93- Object . entries ( config . headers ) . map ( ( [ key , value ] ) => [ key , String ( value ) ] )
94- ) ;
95-
9692 let body : BodyInit ;
9793 let contentType = "application/json" ;
9894
@@ -107,14 +103,14 @@ export function axiosToFetchResponse(axiosRes: AxiosResponse): Response {
107103 body = JSON . stringify ( data ) ;
108104 }
109105
110- if ( ! headersObj [ "content-type" ] ) {
111- headersObj [ "content-type" ] = contentType ;
106+ if ( ! config . headers [ "content-type" ] ) {
107+ config . headers [ "content-type" ] = contentType ;
112108 }
113109
114110 const responseInit : ResponseInit = {
115111 status,
116112 statusText,
117- headers : new Headers ( headersObj ) ,
113+ headers : config . headers ,
118114 } ;
119115
120116 return new Response ( body , responseInit ) ;
You can’t perform that action at this time.
0 commit comments