diff --git a/packages/openapi-to-graphql/src/resolver_builder.ts b/packages/openapi-to-graphql/src/resolver_builder.ts index 49a18f9d..05685057 100644 --- a/packages/openapi-to-graphql/src/resolver_builder.ts +++ b/packages/openapi-to-graphql/src/resolver_builder.ts @@ -446,10 +446,18 @@ export function getResolver({ * * NOTE: This may cause the user to encounter unexpected changes */ - headers['content-type'] = - typeof operation.payloadContentType !== 'undefined' - ? operation.payloadContentType - : 'application/json' + if (operation.method !== 'get') + { + /** + * the check is done on the 'get' operation to determine if there is a payload because + * operation.payloadRequired is not always correctly initialized (at least during the unit test) + */ + headers['content-type'] = + typeof operation.payloadContentType !== 'undefined' + ? operation.payloadContentType + : 'application/json' + } + headers['accept'] = typeof operation.responseContentType !== 'undefined' ? operation.responseContentType