Escape arguments to curl
Created by: chrismwendt
Previously, whitespace in the GraphQL input could get compressed away.
curl commands now look like this:
curl \
-H 'Authorization: token abcdef' \
-d \{\"query\":\"query { currentUser { username } }\",\"variables\":\{}} \
sourcegraph.com/.api/graphql
Merge request reports
Activity
Created by: slimsag
Question about your solution here: prior to this change running this command:
echo 'query($query: String!) { search(query: $query) { results { resultCount } } }' | src api -vars '{"query": "abc"}' --get-curl 'query=abc=foo' 'foo=bar'
Would produce:
curl \ -H 'Authorization: token <redacted>' \ -d '{"query":"query($query: String!) { search(query: $query) { results { resultCount } } }","variables":{"foo":"bar","query":"abc=foo"}}' \ https://sourcegraph.com/.api/graphql
Now it produces (very long line, see horizontal scrollbar):
curl \ -H 'Authorization: token <redacted>' \ -d '{"query":"query($query: String!) { \n search(query: $query) {\n results {\n resultCount\n }\n }\n}\n","variables":{"foo":"bar","query":"abc=foo"}}' \ https://sourcegraph.com/.api/graphql
Created by: chrismwendt
Yeah, unfortunately there is no golang implementation of GraphQL minification (there's a Node.js one https://github.com/rse/graphql-query-compress).
There appears to be a bunch of trailing whitespace on the first line of your query, in particular.
Please register or sign in to reply