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(
1616 options : RequestInitExtended = { } ,
1717) : Promise < ParsedOpenApi3Documentation > {
1818 entrypointUrl = removeTrailingSlash ( entrypointUrl ) ;
19- let headers : HeadersInit | undefined =
19+ const headersObject =
2020 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+ }
2325
2426 return fetch ( entrypointUrl , { ...options , headers : headers } )
2527 . then ( ( res ) => Promise . all ( [ res , res . json ( ) ] ) )
You can’t perform that action at this time.
0 commit comments