File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,12 @@ export default function parseOpenApi3Documentation(
16
16
options : RequestInitExtended = { } ,
17
17
) : Promise < ParsedOpenApi3Documentation > {
18
18
entrypointUrl = removeTrailingSlash ( entrypointUrl ) ;
19
- let headers : HeadersInit | undefined =
19
+ const headersObject =
20
20
typeof options . headers === "function" ? options . headers ( ) : options . headers ;
21
- headers = new Headers ( headers ) ;
22
- headers . append ( "Accept" , "application/vnd.openapi+json" ) ;
21
+ const headers = new Headers ( headersObject ) ;
22
+ if ( ! headers . get ( "Accept" ) ?. includes ( "application/vnd.openapi+json" ) ) {
23
+ headers . append ( "Accept" , "application/vnd.openapi+json" ) ;
24
+ }
23
25
24
26
return fetch ( entrypointUrl , { ...options , headers : headers } )
25
27
. then ( ( res ) => Promise . all ( [ res , res . json ( ) ] ) )
You can’t perform that action at this time.
0 commit comments