doc: style fixes
This commit is contained in:
@@ -4,9 +4,8 @@ The *Kapow!* Resource Tree
|
||||
This is the model that *Kapow!* uses to expose the internals of the user request
|
||||
being serviced.
|
||||
|
||||
|
||||
We use this tree to get access to any data that comes in the request,
|
||||
as well as to compose the response.
|
||||
We use this tree to get access to any data that comes in the request, as well as
|
||||
to compose the response.
|
||||
|
||||
We access the resource tree easily with the ``kapow set`` and ``kapow get``
|
||||
subcommands.
|
||||
@@ -47,6 +46,7 @@ Overview
|
||||
│ └──── <name> HTTP request cookie
|
||||
└──── body Response body
|
||||
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
@@ -59,13 +59,13 @@ The HTTP method of the incoming request.
|
||||
|
||||
If the user runs:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ curl -X POST http://kapow.example:8080
|
||||
|
||||
then, when handling the request:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow get /request/method
|
||||
POST
|
||||
@@ -74,20 +74,19 @@ then, when handling the request:
|
||||
``/request/host`` Resource
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The ``Host`` header as defined in the HTTP/1.1 spec of the incoming
|
||||
request.
|
||||
The ``Host`` header as defined in the HTTP/1.1 spec of the incoming request.
|
||||
|
||||
**Sample Usage**
|
||||
|
||||
If the user runs:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ curl http://kapow.example:8080
|
||||
|
||||
then, when handling the request:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow get /request/host
|
||||
kapow.example
|
||||
@@ -102,17 +101,18 @@ Contains the path substring of the URL.
|
||||
|
||||
If the user runs:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ curl http://kapow.example:8080/foo/bar?qux=1
|
||||
|
||||
then, when handling the request:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow get /request/path
|
||||
/foo/bar
|
||||
|
||||
|
||||
``/request/matches/<name>`` Resource
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -122,23 +122,24 @@ Contains the part of the URL captured by the pattern ``name``.
|
||||
|
||||
For a route defined like this:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow route add /foo/{mymatch}/bar
|
||||
|
||||
if the user runs:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ curl http://kapow.example:8080/foo/1234/bar
|
||||
|
||||
then, when handling the request:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow get /request/matches/mymatch
|
||||
1234
|
||||
|
||||
|
||||
``/request/params/<name>`` Resource
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -148,13 +149,13 @@ Contains the value of the URL parameter ``name``
|
||||
|
||||
If the user runs:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ curl http://kapow.example:8080/foo?myparam=bar
|
||||
|
||||
then, when handling the request:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow get /request/params/myparam
|
||||
myparam
|
||||
@@ -169,13 +170,13 @@ Contains the value of the HTTP header ``name`` of the incoming request.
|
||||
|
||||
If the user runs:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ curl -H X-My-Header=Bar http://kapow.example:8080/
|
||||
|
||||
then, when handling the request:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow get /request/headers/X-My-Header
|
||||
Bar
|
||||
@@ -190,17 +191,18 @@ Contains the value of the HTTP cookie ``name`` of the incoming request.
|
||||
|
||||
If the user runs:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ curl --cookie "MYCOOKIE=Bar" http://kapow.example:8080/
|
||||
$ curl --cookie MYCOOKIE=Bar http://kapow.example:8080/
|
||||
|
||||
then, when handling the request:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow get /request/cookies/MYCOOKIE
|
||||
Bar
|
||||
|
||||
|
||||
``/request/form/<name>`` Resource
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -210,13 +212,13 @@ Contains the value of the field ``name`` of the incoming request.
|
||||
|
||||
If the user runs:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ curl -F -d myfield=foo http://kapow.example:8080/
|
||||
|
||||
then, when handling the request:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow get /request/form/myfield
|
||||
foo
|
||||
@@ -231,13 +233,13 @@ Contains the name of the file uploaded through the incoming request.
|
||||
|
||||
If the user runs:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ curl -F -d myfile=@filename.txt http://kapow.example:8080/
|
||||
|
||||
then, when handling the request:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow get /request/files/myfile/filename
|
||||
filename.txt
|
||||
@@ -252,13 +254,13 @@ Contents of the file that is being uploaded in the incoming request.
|
||||
|
||||
If the user runs:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ curl -F -d myfile=@filename.txt http://kapow.example:8080/
|
||||
|
||||
then, when handling the request:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow get /request/files/myfile/content
|
||||
...filename.txt contents...
|
||||
@@ -273,13 +275,13 @@ Raw contents of the incoming request HTTP body.
|
||||
|
||||
If the user runs:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ curl --data-raw foobar http://kapow.example:8080/
|
||||
|
||||
then, when handling the request:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow get /request/body
|
||||
foobar
|
||||
@@ -294,7 +296,7 @@ Contains the status code given in the user response.
|
||||
|
||||
If during the request handling:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow set /response/status 418
|
||||
|
||||
@@ -310,7 +312,7 @@ Contains the value of the header ``name`` in the user response.
|
||||
|
||||
If during the request handling:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow set /response/headers/X-My-Header Foo
|
||||
|
||||
@@ -324,12 +326,11 @@ value ``Foo``.
|
||||
Contains the value of the cookie ``name`` that will be set to the user
|
||||
response.
|
||||
|
||||
|
||||
**Sample Usage**
|
||||
|
||||
If during the request handling:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow set /response/cookies/MYCOOKIE Foo
|
||||
|
||||
@@ -346,7 +347,7 @@ Contains the value of the response HTTP body.
|
||||
|
||||
If during the request handling:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: console
|
||||
|
||||
$ kapow set /response/body foobar
|
||||
|
||||
|
||||
Reference in New Issue
Block a user