···11+// copy-pasted from @hey-api/client-fetch
22+export const mergeHeaders = (
33+ ...headers: Array<RequestInit['headers'] | undefined>
44+): Headers => {
55+ const mergedHeaders = new Headers();
66+ for (const header of headers) {
77+ if (!header || typeof header !== 'object') {
88+ continue;
99+ }
1010+1111+ const iterator =
1212+ header instanceof Headers ? header.entries() : Object.entries(header);
1313+1414+ for (const [key, value] of iterator) {
1515+ if (value === null) {
1616+ mergedHeaders.delete(key);
1717+ } else if (Array.isArray(value)) {
1818+ for (const v of value) {
1919+ mergedHeaders.append(key, v as string);
2020+ }
2121+ } else if (value !== undefined) {
2222+ // assume object headers are meant to be JSON stringified, i.e. their
2323+ // content value in OpenAPI specification is 'application/json'
2424+ mergedHeaders.set(
2525+ key,
2626+ typeof value === 'object' ? JSON.stringify(value) : (value as string),
2727+ );
2828+ }
2929+ }
3030+ }
3131+ return mergedHeaders;
3232+};
+6-1
packages/openapi-ts/src/types/config.d.ts
···5050 */
5151 exclude?: string;
5252 /**
5353+ * You pass any valid Fetch API options to the request for fetching your
5454+ * specification. This is useful if your file is behind auth for example.
5555+ */
5656+ fetch?: RequestInit;
5757+ /**
5358 * Process only parts matching the regular expression. You can select both
5459 * operations and components by reference within the bundled input. In
5560 * case of conflicts, `exclude` takes precedence over `include`.
···133138 input:
134139 | 'https://get.heyapi.dev/<organization>/<project>'
135140 | (string & {})
136136- | Record<string, unknown>
141141+ | (Record<string, unknown> & { path?: never })
137142 | Input;
138143 /**
139144 * The relative location of the logs folder