From 039d7286f4d88ba8a4c6f7451f9081a48fd7b86b Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Mon, 30 Dec 2024 09:48:16 +0100 Subject: [PATCH] docs(recipes): update plain-text-handler.rst --- docs/user/recipes/plain-text-handler.rst | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/docs/user/recipes/plain-text-handler.rst b/docs/user/recipes/plain-text-handler.rst index 319ddc0e9..278be573f 100644 --- a/docs/user/recipes/plain-text-handler.rst +++ b/docs/user/recipes/plain-text-handler.rst @@ -1,23 +1,18 @@ -.. _plain-text-recipe: +.. _plain_text_handler_recipe: -Handling Plain Text -=================== - -.. _custom-text-handler: - -Custom Text Media Handler -========================= +Handling Plain Text as Media +============================ This example demonstrates how to create a custom handler in Falcon to -process `text/plain` media type. The handler implements serialization +process the ``text/plain`` media type. The handler implements serialization and deserialization of textual content, respecting the charset specified -in the `Content-Type` header or defaulting to `utf-8` when no charset is provided. +in the ``Content-Type`` header (or defaulting to ``utf-8`` when no charset is provided). .. literalinclude:: ../../../examples/recipes/plain_text_main.py :language: python To use this handler, register it in the Falcon application's media -options for both requests and responses: +options for both request and response: .. code:: python @@ -29,7 +24,7 @@ options for both requests and responses: app.resp_options.media_handlers['text/plain'] = TextHandler() With this setup, the application can handle textual data directly -as `text/plain`, ensuring support for various character encodings as needed. +as ``text/plain``, ensuring support for various character encodings as needed. .. warning:: Be sure to validate and limit the size of incoming data when