From dc5a966548df973d0fd2d3a28bad65d0436f6fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Sat, 3 Jul 2021 21:51:28 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Allow=20setting=20the=20`response?= =?UTF-8?q?=5Fclass`=20to=20`RedirectResponse`=20and=20returning=20the=20U?= =?UTF-8?q?RL=20from=20the=20function=20(#3457)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/en/docs/advanced/custom-response.md | 31 ++++++++++++++++ docs_src/custom_response/tutorial006.py | 2 +- docs_src/custom_response/tutorial006b.py | 9 +++++ docs_src/custom_response/tutorial006c.py | 9 +++++ docs_src/custom_response/tutorial009b.py | 10 ++++++ fastapi/applications.py | 20 +++++------ fastapi/openapi/utils.py | 15 +++++++- fastapi/routing.py | 35 ++++++++++--------- .../test_custom_response/test_tutorial006.py | 26 ++++++++++++++ .../test_custom_response/test_tutorial006b.py | 32 +++++++++++++++++ .../test_custom_response/test_tutorial006c.py | 32 +++++++++++++++++ .../test_custom_response/test_tutorial009.py | 17 +++++++++ .../test_custom_response/test_tutorial009b.py | 17 +++++++++ 13 files changed, 226 insertions(+), 29 deletions(-) create mode 100644 docs_src/custom_response/tutorial006b.py create mode 100644 docs_src/custom_response/tutorial006c.py create mode 100644 docs_src/custom_response/tutorial009b.py create mode 100644 tests/test_tutorial/test_custom_response/test_tutorial006b.py create mode 100644 tests/test_tutorial/test_custom_response/test_tutorial006c.py create mode 100644 tests/test_tutorial/test_custom_response/test_tutorial009.py create mode 100644 tests/test_tutorial/test_custom_response/test_tutorial009b.py diff --git a/docs/en/docs/advanced/custom-response.md b/docs/en/docs/advanced/custom-response.md index fa253305e..20b694ced 100644 --- a/docs/en/docs/advanced/custom-response.md +++ b/docs/en/docs/advanced/custom-response.md @@ -161,10 +161,33 @@ An alternative JSON response using