Skip to content

Commit

Permalink
Merge pull request #486 from geoffjukes/master
Browse files Browse the repository at this point in the history
Change HTTP details
  • Loading branch information
mattbennett committed Oct 24, 2017
2 parents 3f0209a + 8fdd85d commit 126906a
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions docs/built_in_extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,17 @@ An example of using the ``BROADCAST`` mode:

Events are serialized into JSON for transport over the wire.

HTTP GET & POST
HTTP
---------------

Nameko's HTTP entrypoint supports simple GET and POST:
The HTTP entrypoint is built on top of `werkzeug <http://werkzeug.pocoo.org/>`_, and supports all the standard HTTP methods (GET/POST/DELETE/PUT etc)

Service methods must return one of:

- a string, which becomes the response body
- a 2-tuple ``(status code, response body)``
- a 3-tuple ``(status_code, headers dict, response body)``
- an instance of :class:`werkzeug.wrappers.Response`

.. literalinclude:: examples/http.py

Expand Down Expand Up @@ -75,13 +82,7 @@ Nameko's HTTP entrypoint supports simple GET and POST:
received: post body
The HTTP entrypoint is built on top of `werkzeug <http://werkzeug.pocoo.org/>`_. Service methods must return one of:

- a string, which becomes the response body
- a 2-tuple ``(status code, response body)``
- a 3-tuple ``(status_code, headers dict, response body)``
- an instance of :class:`werkzeug.wrappers.Response`
A more advanced example:

.. literalinclude:: examples/advanced_http.py

Expand Down Expand Up @@ -127,7 +128,14 @@ You can control formatting of errors returned from your service by overriding :m
{"message": "Argument `foo` is required.", "error": "INVALID_ARGUMENTS"}
You can change the HTTP port and IP using the `WEB_SERVER_ADDRESS` config setting:

.. code-block:: yaml
# foobar.yaml
AMQP_URI: 'pyamqp://guest:guest@localhost'
WEB_SERVER_ADDRESS: '0.0.0.0:8000'
Timer
-----
Expand Down

0 comments on commit 126906a

Please sign in to comment.