Skip to content

Commit

Permalink
docs: refactor "Hooks" usage documentation (#3826)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored Oct 18, 2024
1 parent d060d41 commit 6f79fb3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/usage/lifecycle-hooks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Before Request
--------------

The ``before_request`` hook runs immediately before calling the route handler function. It
can be any callable accepting a :class:`Request <.connection.Request>` as its first parameter
can be any callable accepting a :class:`~litestar.connection.Request` as its first parameter
and returns either ``None`` or a value that can be used in a response.
If a value is returned, the router handler for this request will be bypassed.

Expand All @@ -34,7 +34,7 @@ After Request
-------------

The ``after_request`` hook runs after the route handler returned and the response object
has been resolved. It can be any callable which takes a :class:`Response <.response.Response>`
has been resolved. It can be any callable which takes a :class:`~litestar.response.Response`
instance as its first parameter, and returns a ``Response`` instance. The ``Response``
instance returned does not necessarily have to be the one that was received.

Expand All @@ -48,7 +48,7 @@ After Response
--------------

The ``after_response`` hook runs after the response has been returned by the server.
It can be any callable accepting a :class:`Request <.connection.Request>` as its first parameter
It can be any callable accepting a :class:`~litestar.connection.Request` as its first parameter
and does not return any value.

This hook is meant for data post-processing, transmission of data to third party
Expand All @@ -60,8 +60,8 @@ services, gathering of metrics, etc.

.. note::

Since the request has already been returned by the time the `after_response` is called,
the updated state of `COUNTER` is not reflected in the response.
Since the request has already been returned by the time the ``after_response`` is called,
the updated state of ``COUNTER`` is not reflected in the response.


Layered hooks
Expand Down

0 comments on commit 6f79fb3

Please sign in to comment.