Skip to content

Commit 6bd7258

Browse files
Lionel SchiepersAlan-Cha
Lionel Schiepers
authored andcommitted
fix: check if there is a payload by checking the http method
fix: check if there is a payload by checking the http method instead of payloadRequired because that field is not always correctly initialized during unit test Signed-off-by: Lionel Schiepers <[email protected]>
1 parent fddd721 commit 6bd7258

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: packages/openapi-to-graphql/src/resolver_builder.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,12 @@ export function getResolver<TSource, TContext, TArgs>({
459459
*
460460
* NOTE: This may cause the user to encounter unexpected changes
461461
*/
462-
if (operation.payloadRequired)
462+
if (operation.method !== 'get')
463463
{
464+
/**
465+
* the check is done on the 'get' operation to determine if there is a payload because
466+
* operation.payloadRequired is not always correctly initialized (at least during the unit test)
467+
*/
464468
headers['content-type'] =
465469
typeof operation.payloadContentType !== 'undefined'
466470
? operation.payloadContentType

0 commit comments

Comments
 (0)