From 01fdab55e9f1154e7f8eda32a151a9bb810ac5e3 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Sun, 28 Feb 2016 19:31:43 +0800 Subject: [PATCH] Explain how to send fieldnames and headers starting with '-' Closes #355 --- README.rst | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 95cc00a4..f92d5b63 100644 --- a/README.rst +++ b/README.rst @@ -341,11 +341,28 @@ their type is distinguished only by the separator used: | | in a ``multipart/form-data`` request. | +-----------------------+-----------------------------------------------------+ + 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 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: `Redirected input`_ allows for passing arbitrary data to be sent with the