Open ducaale opened 2 years ago
Probably because of your shell. It works fine for me on PowerShell
> http --offline --print=B : \\0=
{
"\\0": ""
}
@YSCohen can you confirm which version of HTTPie you are using? I think the issue I am reporting is something that was introduced by the nested json changes.
3.2.1
If I do it in WSL it drops the backslashes.
$ python3 -m httpie --offline --print=B : \\0=
{
"0": ""
}
Probably because of your shell. It works fine for me on PowerShell
> http --offline --print=B : \\0= { "\\0": "" }
PowerShell doesn't treat backslashes specially so you're actually handing HTTPie two backslashes instead of one. It's clearer if we use single quotes. Bash:
$ http --offline --print=B : '\0='
{
"0": ""
}
$ http --offline --print=B : '\\0='
{
"\\0": ""
}
PowerShell:
PS > http.exe --offline --print=B : '\0='
{
"0": ""
}
PS > http.exe --offline --print=B : '\\0='
{
"\\0": ""
}
Not mentioned in the OP is that this used to work differently:
$ git checkout 2.0.0
HEAD is now at a7e5228 Cleanup
$ python3 -m httpie --offline --print=B : '\0='
{
"\\0": ""
}
Yes, it’s a bug. It looks like the nested JSON array notation is getting in the way. Here’s a minimal reproduction:
$ http --offline pie.dev/post '\0=\0'
{
"0": "\\0"
}
Checklist
Minimal reproduction code and steps
Current result
Expected result
Debug output
Please re-run the command with
--debug
, then copy the entire command & output and paste both below:Additional information, screenshots, or code examples
N/A