We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 60aa614 commit 873363aCopy full SHA for 873363a
1 file changed
src/openapi3/parseOpenApi3Documentation.ts
@@ -16,10 +16,12 @@ export default function parseOpenApi3Documentation(
16
options: RequestInitExtended = {},
17
): Promise<ParsedOpenApi3Documentation> {
18
entrypointUrl = removeTrailingSlash(entrypointUrl);
19
- let headers: HeadersInit | undefined =
+ const headersObject =
20
typeof options.headers === "function" ? options.headers() : options.headers;
21
- headers = new Headers(headers);
22
- headers.append("Accept", "application/vnd.openapi+json");
+ const headers = new Headers(headersObject);
+ if (!headers.get("Accept")?.includes("application/vnd.openapi+json")) {
23
+ headers.append("Accept", "application/vnd.openapi+json");
24
+ }
25
26
return fetch(entrypointUrl, { ...options, headers: headers })
27
.then((res) => Promise.all([res, res.json()]))
0 commit comments