Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for generate_html_response (0.59 sec)

  1. docs_src/custom_response/tutorial004_py39.py

    from fastapi import FastAPI
    from fastapi.responses import HTMLResponse
    
    app = FastAPI()
    
    
    def generate_html_response():
        html_content = """
        <html>
            <head>
                <title>Some HTML in here</title>
            </head>
            <body>
                <h1>Look ma! HTML!</h1>
            </body>
        </html>
        """
        return HTMLResponse(content=html_content, status_code=200)
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 491 bytes
    - Viewed (0)
  2. docs/zh/docs/advanced/custom-response.md

    ### 直接返回 `HTMLResponse`
    
    比如像这样:
    
    {* ../../docs_src/custom_response/tutorial004.py hl[7,23,21] *}
    
    在这个例子中,函数 `generate_html_response()` 已经生成并返回 `Response` 对象而不是在 `str` 中返回 HTML。
    
    通过返回函数 `generate_html_response()` 的调用结果,你已经返回一个重载 **FastAPI** 默认行为的 `Response` 对象,
    
    但如果你在 `response_class` 中也传入了 `HTMLResponse`,**FastAPI** 会知道如何在 OpenAPI 和交互式文档中使用 `text/html` 将其文档化为 HTML。
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 7.5K bytes
    - Viewed (0)
  3. docs/ja/docs/advanced/custom-response.md

    #### `HTMLResponse` を直接返す
    
    例えば、このようになります:
    
    {* ../../docs_src/custom_response/tutorial004.py hl[7,21,23] *}
    
    この例では、関数 `generate_html_response()` は、`str` のHTMLを返すのではなく `Response` を生成して返しています。
    
    `generate_html_response()` を呼び出した結果を返すことにより、**FastAPI** の振る舞いを上書きする `Response` が既に返されています。
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 10.4K bytes
    - Viewed (0)
  4. docs/ko/docs/advanced/custom-response.md

    ### `HTMLResponse`직접 반환하기
    
    예를 들어, 다음과 같이 작성할 수 있습니다:
    
    {* ../../docs_src/custom_response/tutorial004.py hl[7,21,23] *}
    
    이 예제에서, `generate_html_response()` 함수는 HTML을 `str`로 반환하는 대신 이미 `Response`를 생성하고 반환합니다.
    
    `generate_html_response()`를 호출한 결과를 반환함으로써, 기본적인 **FastAPI** 기본 동작을 재정의 하는 `Response`를 이미 반환하고 있습니다.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Feb 15 11:21:20 UTC 2025
    - 13.4K bytes
    - Viewed (0)
  5. docs/es/docs/advanced/custom-response.md

    Por ejemplo, podría ser algo así:
    
    {* ../../docs_src/custom_response/tutorial004_py39.py hl[7,21,23] *}
    
    En este ejemplo, la función `generate_html_response()` ya genera y devuelve una `Response` en lugar de devolver el HTML en un `str`.
    
    Al devolver el resultado de llamar a `generate_html_response()`, ya estás devolviendo una `Response` que sobrescribirá el comportamiento por defecto de **FastAPI**.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 13.2K bytes
    - Viewed (0)
  6. docs/en/docs/advanced/custom-response.md

    For example, it could be something like:
    
    {* ../../docs_src/custom_response/tutorial004_py39.py hl[7,21,23] *}
    
    In this example, the function `generate_html_response()` already generates and returns a `Response` instead of returning the HTML in a `str`.
    
    By returning the result of calling `generate_html_response()`, you are already returning a `Response` that will override the default **FastAPI** behavior.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 12.4K bytes
    - Viewed (0)
  7. docs/de/docs/advanced/custom-response.md

    {* ../../docs_src/custom_response/tutorial004_py39.py hl[7,21,23] *}
    
    In diesem Beispiel generiert die Funktion `generate_html_response()` bereits eine `Response` und gibt sie zurück, anstatt das HTML in einem `str` zurückzugeben.
    
    Indem Sie das Ergebnis des Aufrufs von `generate_html_response()` zurückgeben, geben Sie bereits eine `Response` zurück, die das Standardverhalten von **FastAPI** überschreibt.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 14.4K bytes
    - Viewed (0)
  8. docs/ru/docs/advanced/custom-response.md

    Например, это может быть что-то вроде:
    
    {* ../../docs_src/custom_response/tutorial004_py39.py hl[7,21,23] *}
    
    В этом примере функция `generate_html_response()` уже генерирует и возвращает `Response` вместо возврата HTML в `str`.
    
    Возвращая результат вызова `generate_html_response()`, вы уже возвращаете `Response`, который переопределит поведение **FastAPI** по умолчанию.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 19.7K bytes
    - Viewed (0)
  9. docs/pt/docs/advanced/custom-response.md

    Por exemplo, poderia ser algo como:
    
    {* ../../docs_src/custom_response/tutorial004_py39.py hl[7,21,23] *}
    
    Neste exemplo, a função `generate_html_response()` já cria e retorna uma `Response` em vez de retornar o HTML em uma `str`.
    
    Ao retornar o resultado chamando `generate_html_response()`, você já está retornando uma `Response` que irá sobrescrever o comportamento padrão do **FastAPI**.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 13.8K bytes
    - Viewed (0)
Back to top