-
Notifications
You must be signed in to change notification settings - Fork 373
Closed
Description
When working with a graphql endpoint I discovered an interesting bug:
A generated sample of cURL:
curl --location --request POST "http://localhost:9999/graphql" ^
--header "Content-Type: application/json" ^
--header "Accept: application/json" ^
--header "Origin: http://localhost:9999" ^
--data-raw "{\"query\":\"{\r\n findScenes(\r\n filter: {per_page: 0}\r\n scene_filter: {is_missing: \\"performers\\"}){\r\n count\r\n scenes {\r\n id\r\n title\r\n path\r\n }\r\n }\r\n}\",\"variables\":{}}"
caused an error "json body could not be decoded: invalid character 'p' in string escape code" indicating that there is problem with the string being passed in graphql query:
{
findScenes(
filter: {per_page: 0}
scene_filter: {is_missing: "performers"}){
count
scenes {
id
title
path
}
}
}
This graphql query works OK inside postman, only the generated cURL is missing additional backslashes, 1 on each side, like so: \\\"performers\\\
The following fixed cURL command works fine:
curl --location --request POST "http://localhost:9999/graphql" ^
--header "Content-Type: application/json" ^
--header "Accept: application/json" ^
--header "Origin: http://localhost:9999" ^
--data-raw "{\"query\":\"{\r\n findScenes(\r\n filter: {per_page: 0}\r\n scene_filter: {is_missing: \\\"performers\\\"}){\r\n count\r\n scenes {\r\n id\r\n title\r\n path\r\n }\r\n }\r\n}\",\"variables\":{}}"
Postman version: v8.2.1
OS: Windows 10
Curl binary path: C:\Windows\System32\curl.exe
Curl binary details:
curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL
Release-Date: 2017-11-14, security patched: 2019-11-05
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels