mirror of
https://github.com/httpie/cli.git
synced 2025-06-13 00:07:26 +02:00
Explain how to send fieldnames and headers starting with '-'
Closes #355
This commit is contained in:
parent
1127557742
commit
01fdab55e9
19
README.rst
19
README.rst
@ -341,11 +341,28 @@ their type is distinguished only by the separator used:
|
|||||||
| | in a ``multipart/form-data`` request. |
|
| | in a ``multipart/form-data`` request. |
|
||||||
+-----------------------+-----------------------------------------------------+
|
+-----------------------+-----------------------------------------------------+
|
||||||
|
|
||||||
|
|
||||||
You can use ``\`` to escape characters that shouldn't be used as separators
|
You can use ``\`` to escape characters that shouldn't be used as separators
|
||||||
(or parts thereof). For instance, ``foo\==bar`` will become a data key/value
|
(or parts thereof). For instance, ``foo\==bar`` will become a data key/value
|
||||||
pair (``foo=`` and ``bar``) instead of a URL parameter.
|
pair (``foo=`` and ``bar``) instead of a URL parameter.
|
||||||
|
|
||||||
You can also quote values, e.g. ``foo="bar baz"``.
|
Often it is necessary to quote the values, e.g. ``foo='bar baz'``.
|
||||||
|
|
||||||
|
If any of the field names or headers starts with a minus
|
||||||
|
(e.g., ``-fieldname``), you need to place all such items after the special
|
||||||
|
token ``--`` to prevent confusion with ``--arguments``:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ http httpbin.org/post -- -name-starting-with-dash=foo --Weird-Header:bar
|
||||||
|
|
||||||
|
.. code-block:: http
|
||||||
|
POST /post HTTP/1.1
|
||||||
|
--Weird-Header: yes
|
||||||
|
|
||||||
|
{
|
||||||
|
"-name-starting-with-dash": "value"
|
||||||
|
}
|
||||||
|
|
||||||
Note that data fields aren't the only way to specify request data:
|
Note that data fields aren't the only way to specify request data:
|
||||||
`Redirected input`_ allows for passing arbitrary data to be sent with the
|
`Redirected input`_ allows for passing arbitrary data to be sent with the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user