Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cURL Breaking without -g #253

Closed
chaffeqa opened this issue May 20, 2020 · 4 comments · Fixed by #258
Closed

cURL Breaking without -g #253

chaffeqa opened this issue May 20, 2020 · 4 comments · Fixed by #258

Comments

@chaffeqa
Copy link

chaffeqa commented May 20, 2020

Describe the bug
When using GraphQL query bodies in GET requests, the codegen cURL will fail with
curl: (3) nested brace in URL position 122:.
However it will pass if -g is added to the request.

To Reproduce
Steps to reproduce the behavior:

curl --location --request GET 'https://picks-dev.cbssports.com/graphql?query=query%20APIBracketLobbyQuery%20{%0A%20%20bpc:%20gameInstance(game:%20{%20uid:%20%22cbs-ncaab-tournament-challenge%22%20})%20{%0A%20%20%20%20...APIGameInstanceFragment%0A%20%20}%0A%20%20bpm:%20gameInstance(game:%20{%20uid:%20%22cbs-ncaab-tournament-manager%22%20})%20{%0A%20%20%20%20...APIGameInstanceFragment%0A%20%20}%0A%20%20currentUser%20{%0A%20%20%20%20preferredEntryName%0A%20%20%20%20bpcEntries:%20entries(%0A%20%20%20%20%20%20first:%20200%0A%20%20%20%20%20%20gameInstanceUid:%20%22cbs-ncaab-tournament-challenge%22%0A%20%20%20%20)%20{%0A%20%20%20%20%20%20edges%20{%0A%20%20%20%20%20%20%20%20node%20{%0A%20%20%20%20%20%20%20%20%20%20...APILobbyEntryFragment%0A%20%20%20%20%20%20%20%20}%0A%20%20%20%20%20%20}%0A%20%20%20%20}%0A%20%20%20%20bpmEntries:%20entries(%0A%20%20%20%20%20%20first:%20200%0A%20%20%20%20%20%20gameInstanceUid:%20%22cbs-ncaab-tournament-manager%22%0A%20%20%20%20)%20{%0A%20%20%20%20%20%20edges%20{%0A%20%20%20%20%20%20%20%20node%20{%0A%20%20%20%20%20%20%20%20%20%20...APILobbyEntryFragment%0A%20%20%20%20%20%20%20%20}%0A%20%20%20%20%20%20}%0A%20%20%20%20}%0A%20%20}%0A}%0Afragment%20APIGameInstanceFragment%20on%20GameInstance%20{%0A%20%20uid%0A%20%20seasons(first:%20100)%20{%0A%20%20%20%20edges%20{%0A%20%20%20%20%20%20node%20{%0A%20%20%20%20%20%20%20%20id%0A%20%20%20%20%20%20%20%20year%0A%20%20%20%20%20%20%20%20masterProductId%0A%20%20%20%20%20%20%20%20productAbbrev%0A%20%20%20%20%20%20%20%20challengePoolId%0A%20%20%20%20%20%20}%0A%20%20%20%20}%0A%20%20}%0A%20%20currentPeriod%20{%0A%20%20%20%20...APILobbyCurrentPeriodFragment%0A%20%20}%0A}%0Afragment%20APILobbyCurrentPeriodFragment%20on%20Period%20{%0A%20%20locksAt%0A%20%20isPickable%0A%20%20segment%20{%0A%20%20%20%20shouldPromoteToPlay%0A%20%20%20%20season%20{%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20masterProductId%0A%20%20%20%20%20%20challengePoolId%0A%20%20%20%20}%0A%20%20}%0A}%0Afragment%20APILobbyEntryFragment%20on%20Entry%20{%0A%20%20id%0A%20%20name%0A%20%20fantasyPoints%0A%20%20poolRank%0A%20%20url%0A%20%20needsToMakePicks%0A%20%20avatarUrl%0A%20%20periodPoint%20{%0A%20%20%20%20poolRank%0A%20%20%20%20fantasyPoints%0A%20%20}%0A%20%20pool%20{%0A%20%20%20%20id%0A%20%20%20%20name%0A%20%20%20%20url%0A%20%20%20%20season%20{%0A%20%20%20%20%20%20masterProductId%0A%20%20%20%20}%0A%20%20}%0A}%0A'

vs

curl -g --location --request GET 'https://picks-dev.cbssports.com/graphql?query=query%20APIBracketLobbyQuery%20{%0A%20%20bpc:%20gameInstance(game:%20{%20uid:%20%22cbs-ncaab-tournament-challenge%22%20})%20{%0A%20%20%20%20...APIGameInstanceFragment%0A%20%20}%0A%20%20bpm:%20gameInstance(game:%20{%20uid:%20%22cbs-ncaab-tournament-manager%22%20})%20{%0A%20%20%20%20...APIGameInstanceFragment%0A%20%20}%0A%20%20currentUser%20{%0A%20%20%20%20preferredEntryName%0A%20%20%20%20bpcEntries:%20entries(%0A%20%20%20%20%20%20first:%20200%0A%20%20%20%20%20%20gameInstanceUid:%20%22cbs-ncaab-tournament-challenge%22%0A%20%20%20%20)%20{%0A%20%20%20%20%20%20edges%20{%0A%20%20%20%20%20%20%20%20node%20{%0A%20%20%20%20%20%20%20%20%20%20...APILobbyEntryFragment%0A%20%20%20%20%20%20%20%20}%0A%20%20%20%20%20%20}%0A%20%20%20%20}%0A%20%20%20%20bpmEntries:%20entries(%0A%20%20%20%20%20%20first:%20200%0A%20%20%20%20%20%20gameInstanceUid:%20%22cbs-ncaab-tournament-manager%22%0A%20%20%20%20)%20{%0A%20%20%20%20%20%20edges%20{%0A%20%20%20%20%20%20%20%20node%20{%0A%20%20%20%20%20%20%20%20%20%20...APILobbyEntryFragment%0A%20%20%20%20%20%20%20%20}%0A%20%20%20%20%20%20}%0A%20%20%20%20}%0A%20%20}%0A}%0Afragment%20APIGameInstanceFragment%20on%20GameInstance%20{%0A%20%20uid%0A%20%20seasons(first:%20100)%20{%0A%20%20%20%20edges%20{%0A%20%20%20%20%20%20node%20{%0A%20%20%20%20%20%20%20%20id%0A%20%20%20%20%20%20%20%20year%0A%20%20%20%20%20%20%20%20masterProductId%0A%20%20%20%20%20%20%20%20productAbbrev%0A%20%20%20%20%20%20%20%20challengePoolId%0A%20%20%20%20%20%20}%0A%20%20%20%20}%0A%20%20}%0A%20%20currentPeriod%20{%0A%20%20%20%20...APILobbyCurrentPeriodFragment%0A%20%20}%0A}%0Afragment%20APILobbyCurrentPeriodFragment%20on%20Period%20{%0A%20%20locksAt%0A%20%20isPickable%0A%20%20segment%20{%0A%20%20%20%20shouldPromoteToPlay%0A%20%20%20%20season%20{%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20masterProductId%0A%20%20%20%20%20%20challengePoolId%0A%20%20%20%20}%0A%20%20}%0A}%0Afragment%20APILobbyEntryFragment%20on%20Entry%20{%0A%20%20id%0A%20%20name%0A%20%20fantasyPoints%0A%20%20poolRank%0A%20%20url%0A%20%20needsToMakePicks%0A%20%20avatarUrl%0A%20%20periodPoint%20{%0A%20%20%20%20poolRank%0A%20%20%20%20fantasyPoints%0A%20%20}%0A%20%20pool%20{%0A%20%20%20%20id%0A%20%20%20%20name%0A%20%20%20%20url%0A%20%20%20%20season%20{%0A%20%20%20%20%20%20masterProductId%0A%20%20%20%20}%0A%20%20}%0A}%0A'

Expected code snippet and corresponding request
Add -g to all cURL requests by default or properly deal with double vs single quotes (#251)

Additional context
collection: 11254382-24f763ba-01f6-4782-85c5-f65f3809457b
Version of postman-code-generators/Postman app: Version 7.24.0 (7.24.0)

@someshkoli
Copy link
Contributor

@chaffeqa can you give an example on how handling quotes can fix this issue ?

@chaffeqa
Copy link
Author

Honestly I didnt really figure that out, but I'm sure its a quoting issue (since the SO solution mentions that and I know that we are dealing with quotes here)... the -g seems to solve the issue though right? Maybe its as simple as always including -g on all GraphQL GET requests?

@someshkoli
Copy link
Contributor

someshkoli commented May 25, 2020

I guess its not just graphql, curl doesn't accept multiple braces in url and requires a -g option. I tried a few and figured this out ^

@chaffeqa
Copy link
Author

ooooo its the braces! thx for figuring that out, the quotes stuff seemed the obvious to me, never thought bout braces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants