Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDocument JSON-escaping in "=" syntax #813
Open
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In
=syntax,")\)are escaped in
json.dumps:$ http -v httpbin.org/post \ dquote='\"' \ multi-line='line 1\nline 2' \ non-ascii=あ \ unicodes='\u3053\u3093\u306b\u3061\u306f\u4e16\u754c' \ ; POST /post HTTP/1.1 ... User-Agent: HTTPie/1.0.3 { "dquote": "\\\"", "multi-line": "line 1\\nline 2" "non-ascii": "あ", ^^^^ actually "\u3042" (not utf-8 representation 0xe38182) "unicodes": "\\u3053\\u3093\\u306b\\u3061\\u306f\\u4e16\\u754c", } HTTP/1.1 200 OK ...This behavior should be documented, shouldn't it?
It's also notable that the escaping can be avoided with
:=:$ http -v httpbin.org/post \ dquote:='"\""' \ multi-line:='"line 1\nline 2"' \ non-ascii:='"あ"' \ unicodes:='"\u3053\u3093\u306b\u3061\u306f\u4e16\u754c"' \ ; POST /post HTTP/1.1 ... User-Agent: HTTPie/1.0.3 { "dquote": "\"", "multi-line": "line 1\nline 2", "non-ascii": "あ", ^^^^ actually "\u3042" (#814) "unicodes": "こんにちは世界" ^^^^^^^^^^^^^^^^ actually "\u3053\u3093\u306b\u3061\u306f\u4e16\u754c" } HTTP/1.1 200 OK ...(Note that non-ascii characters can't avoid escaping, see #814)