From 95205c7dfa7d800eecac52cbd43f3e1df21a8ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lafr=C3=A9choux?= Date: Mon, 2 Sep 2019 15:00:13 +0200 Subject: [PATCH] Docs: document arguments content_type argument --- docs/arguments.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/arguments.rst b/docs/arguments.rst index 4a79c5d1..d9e9ebc4 100644 --- a/docs/arguments.rst +++ b/docs/arguments.rst @@ -80,3 +80,24 @@ view function. @blp.arguments(QueryArgsSchema, location='query') def post(pet_data, query_args): return Pet.create(pet_data, **query_args) + +Content Type +------------ + +When using body arguments, a default content type is assumed depending on the +location. The location / content type mapping can be customized by modifying +``Blueprint.DEFAULT_LOCATION_CONTENT_TYPE_MAPPING``. + +.. code-block:: python + + DEFAULT_LOCATION_CONTENT_TYPE_MAPPING = { + "json": "application/json", + "form": "application/x-www-form-urlencoded", + "files": "multipart/form-data", + +It is also possible to override those defaults in a single resource by passing +a string as ``content_type`` argument to :meth:`Blueprint.arguments +`. + +.. note:: The content type is only used for documentation purpose and has no + impact on request parsing.