Skip to content

Commit 2157a15

Browse files
eokoneyoAlan-Cha
authored andcommitted
consolidate header config for form
Signed-off-by: Eyo Okon Eyo <[email protected]>
1 parent 08bf4b4 commit 2157a15

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/openapi-to-graphql/src/resolver_builder.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,9 @@ export function getResolver<TSource, TContext, TArgs> ({
647647

648648
if (form) {
649649
Object.assign(options.headers, form.getHeaders())
650+
// when is form, remove default content type and leave computation of content-type header to fetch
651+
// see https://github.com/github/fetch/issues/505#issuecomment-293064470
652+
delete options.headers['content-type']
650653
}
651654
}
652655

@@ -703,11 +706,6 @@ export function getResolver<TSource, TContext, TArgs> ({
703706

704707
let response: Response
705708
try {
706-
// if is form, remove default content type and
707-
// let fetch compute appropriate header content-type based off of form data
708-
if (form) {
709-
delete options.headers['content-type']
710-
}
711709
response = await fetch(url.toString(), options)
712710
} catch (err) {
713711
httpLog(err)

0 commit comments

Comments
 (0)