cli
cli copied to clipboard
Document JSON-escaping in "=" syntax
In =
syntax,
- double quotes (
"
) - back slashes (
\
) - non-ascii characters
$ 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)
What tasks remain in this issue? If the documentation needs to be updated, where does it need to be updated?
Hi. I have not seen this issue in 3 years and things seem to have changed. Please wait a moment while I update it.
The description was not well written and was difficult to understand, sorry. I've updated it.
And now I have changed my mind, this is an intuitive specification, no document needed. I'm closing this issue, thank you for looking it over!