Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 1,676 for response (0.17 sec)

  1. docs/zh/docs/advanced/response-directly.md

    直接返回响应可能会有用处,比如返回自定义的响应头和 cookies。
    
    ## 返回 `Response`
    
    事实上,你可以返回任意 `Response` 或者任意 `Response` 的子类。
    
    !!! tip "小贴士"
        `JSONResponse` 本身是一个 `Response` 的子类。
    
    当你返回一个 `Response` 时,**FastAPI** 会直接传递它。
    
    **FastAPI** 不会用 Pydantic 模型做任何数据转换,不会将响应内容转换成任何类型,等等。
    
    这种特性给你极大的可扩展性。你可以返回任何数据类型,重写任何数据声明或者校验,等等。
    
    ## 在 `Response` 中使用 `jsonable_encoder`
    
    由于 **FastAPI** 并未对你返回的 `Response` 做任何改变,你必须确保你已经准备好响应内容。
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu May 12 00:06:16 GMT 2022
    - 3.1K bytes
    - Viewed (0)
  2. docs/em/docs/advanced/custom-response.md

    #### 📨 `HTMLResponse` 🔗
    
    🖼, ⚫️ 💪 🕳 💖:
    
    ```Python hl_lines="7  21  23"
    {!../../../docs_src/custom_response/tutorial004.py!}
    ```
    
    👉 🖼, 🔢 `generate_html_response()` ⏪ 🏗 & 📨 `Response` ↩️ 🛬 🕸 `str`.
    
    🛬 🏁 🤙 `generate_html_response()`, 👆 ⏪ 🛬 `Response` 👈 🔜 🔐 🔢 **FastAPI** 🎭.
    
    ✋️ 👆 🚶‍♀️ `HTMLResponse` `response_class` 💁‍♂️, **FastAPI** 🔜 💭 ❔ 📄 ⚫️ 🗄 & 🎓 🩺 🕸 ⏮️ `text/html`:
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 9.8K bytes
    - Viewed (0)
  3. docs/ja/docs/advanced/response-directly.md

    これは例えば、カスタムヘッダーやcookieを返すときに便利です。
    
    ## `Response` を返す
    
    実際は、`Response` やそのサブクラスを返すことができます。
    
    !!! tip "豆知識"
        `JSONResponse` それ自体は、 `Response` のサブクラスです。
    
    `Response` を返した場合は、**FastAPI** は直接それを返します。
    
    それは、Pydanticモデルのデータ変換や、コンテンツを任意の型に変換したりなどはしません。
    
    これは多くの柔軟性を提供します。任意のデータ型を返したり、任意のデータ宣言やバリデーションをオーバーライドできます。
    
    ## `jsonable_encoder` を `Response` の中で使う
    
    **FastAPI** はあなたが返す `Response` に対して何も変更を加えないので、コンテンツが準備できていることを保証しなければなりません。
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Nov 05 22:50:38 GMT 2020
    - 3.6K bytes
    - Viewed (0)
  4. docs/en/docs/tutorial/response-model.md

    ### `response_model` Priority
    
    If you declare both a return type and a `response_model`, the `response_model` will take priority and be used by FastAPI.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 17.9K bytes
    - Viewed (0)
  5. docs/em/docs/advanced/response-directly.md

    ⚫️ 💪 ⚠, 🖼, 📨 🛃 🎚 ⚖️ 🍪.
    
    ## 📨 `Response`
    
    👐, 👆 💪 📨 🙆 `Response` ⚖️ 🙆 🎧-🎓 ⚫️.
    
    !!! tip
        `JSONResponse` ⚫️ 🎧-🎓 `Response`.
    
    & 🕐❔ 👆 📨 `Response`, **FastAPI** 🔜 🚶‍♀️ ⚫️ 🔗.
    
    ⚫️ 🏆 🚫 🙆 💽 🛠️ ⏮️ Pydantic 🏷, ⚫️ 🏆 🚫 🗜 🎚 🙆 🆎, ♒️.
    
    👉 🤝 👆 📚 💪. 👆 💪 📨 🙆 📊 🆎, 🔐 🙆 💽 📄 ⚖️ 🔬, ♒️.
    
    ## ⚙️ `jsonable_encoder` `Response`
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 2.6K bytes
    - Viewed (0)
  6. cmd/api-response.go

    	w.WriteHeader(statusCode)
    	if response != nil {
    		w.Write(response)
    	}
    }
    
    // mimeType represents various MIME type used API responses.
    type mimeType string
    
    const (
    	// Means no response type.
    	mimeNone mimeType = ""
    	// Means response type is JSON.
    	mimeJSON mimeType = "application/json"
    	// Means response type is XML.
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 33.3K bytes
    - Viewed (2)
  7. internal/http/response-recorder.go

    	"fmt"
    	"io"
    	"net"
    	"net/http"
    	"time"
    )
    
    // ResponseRecorder - is a wrapper to trap the http response
    // status code and to record the response body
    type ResponseRecorder struct {
    	http.ResponseWriter
    	io.ReaderFrom
    	StatusCode int
    	// Log body of 4xx or 5xx responses
    	LogErrBody bool
    	// Log body of all responses
    	LogAllBody bool
    
    	TimeToFirstByte time.Duration
    	StartTime       time.Time
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sat Dec 02 00:13:19 GMT 2023
    - 4.9K bytes
    - Viewed (0)
  8. docs/ru/docs/tutorial/response-model.md

    И ваши помощники разработки также будут счастливы, т.к. оба класса `RedirectResponse` и `JSONResponse` являются подклассами `Response`. Таким образом мы получаем корректную аннотацию типа.
    
    ### Подкласс Response в аннотации типа
    
    Вы также можете указать подкласс `Response` в аннотации типа:
    
    ```Python hl_lines="8-9"
    {!> ../../../docs_src/response_model/tutorial003_03.py!}
    ```
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 30.5K bytes
    - Viewed (0)
  9. docs/zh/docs/tutorial/response-model.md

    ### `response_model_include` 和 `response_model_exclude`
    
    你还可以使用*路径操作装饰器*的 `response_model_include` 和 `response_model_exclude` 参数。
    
    它们接收一个由属性名称 `str` 组成的 `set` 来包含(忽略其他的)或者排除(包含其他的)这些属性。
    
    如果你只有一个 Pydantic 模型,并且想要从输出中移除一些数据,则可以使用这种快捷方法。
    
    !!! tip
        但是依然建议你使用上面提到的主意,使用多个类而不是这些参数。
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 7.9K bytes
    - Viewed (0)
  10. docs/ja/docs/tutorial/response-model.md

    ```Python hl_lines="9 11 16"
    {!../../../docs_src/response_model/tutorial003.py!}
    ```
    
    ここでは、*path operation関数*がパスワードを含む同じ入力ユーザーを返しているにもかかわらず:
    
    ```Python hl_lines="24"
    {!../../../docs_src/response_model/tutorial003.py!}
    ```
    
    ...`response_model`を`UserOut`と宣言したことで、パスワードが含まれていません:
    
    ```Python hl_lines="22"
    {!../../../docs_src/response_model/tutorial003.py!}
    ```
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.3K bytes
    - Viewed (0)
Back to top