Add routes for /request/version and /request/remote in data server. Add resource tree documentation for /request/version and /request/remote. Closes #85

This commit is contained in:
Héctor Hurtado
2020-09-09 12:45:18 +02:00
parent fc19b921be
commit 774b9202b5
2 changed files with 46 additions and 0 deletions
+44
View File
@@ -101,6 +101,28 @@ then, when handling the request:
kapow.example kapow.example
``/request/version`` Resource
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The HTTP version of the incoming request.
Sample Usage
^^^^^^^^^^^^
If the user runs:
.. code-block:: console
$ curl --http1.0 http://kapow.example:8080
then, when handling the request:
.. code-block:: console
$ kapow get /request/version
HTTP/1.0
``/request/path`` Resource ``/request/path`` Resource
~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -123,6 +145,28 @@ then, when handling the request:
/foo/bar /foo/bar
``/request/remote`` Resource
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The IP address of the host making the incoming request.
Sample Usage
^^^^^^^^^^^^
If the user runs:
.. code-block:: console
$ curl http://kapow.example:8080
then, when handling the request:
.. code-block:: console
$ kapow get /request/remote
192.168.100.156
``/request/matches/<name>`` Resource ``/request/matches/<name>`` Resource
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+2
View File
@@ -59,7 +59,9 @@ func Run(bindAddr string, wg *sync.WaitGroup) {
// request // request
{"/handlers/{handlerID}/request/method", "GET", getRequestMethod}, {"/handlers/{handlerID}/request/method", "GET", getRequestMethod},
{"/handlers/{handlerID}/request/host", "GET", getRequestHost}, {"/handlers/{handlerID}/request/host", "GET", getRequestHost},
{"/handlers/{handlerID}/request/version", "GET", getRequestVersion},
{"/handlers/{handlerID}/request/path", "GET", getRequestPath}, {"/handlers/{handlerID}/request/path", "GET", getRequestPath},
{"/handlers/{handlerID}/request/remote", "GET", getRequestRemote},
{"/handlers/{handlerID}/request/matches/{name}", "GET", getRequestMatches}, {"/handlers/{handlerID}/request/matches/{name}", "GET", getRequestMatches},
{"/handlers/{handlerID}/request/params/{name}", "GET", getRequestParams}, {"/handlers/{handlerID}/request/params/{name}", "GET", getRequestParams},
{"/handlers/{handlerID}/request/headers/{name}", "GET", getRequestHeaders}, {"/handlers/{handlerID}/request/headers/{name}", "GET", getRequestHeaders},