postmanlabs / curl-to-postman

Converts curl requests to Postman Collection v2 request objects
Apache License 2.0
65 stars 31 forks source link

Fixed an issue where GraphQL bodies were not generated correctly. #73

Closed VShingala closed 10 months ago

VShingala commented 10 months ago

Overview

This PR fixes issue https://github.com/postmanlabs/postman-app-support/issues/12349.

For certain cURL imported GraphQL requests, sending requests resulted in incorrect an response. Even though mentioning same data in the newly created request and sending this new request was working correctly with the expected response.

RCA

The issue was happening due to generated Postman request having incorrect operationName field for body type graphql. In Postman, we don't have a way to set operationName field yet. So users can not change this and in this case, having it as empty meant server responding with incorrect response.

Fix

We'll not be setting this operationName field at all since Postman hasn't exposed the use of it yet. However, it will be considered towards the detection of graphql body as an optional param.