Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 523 for response (0.24 sec)

  1. docs/en/docs/advanced/response-change-status-code.md

    For those cases, you can use a `Response` parameter.
    
    ## Use a `Response` parameter
    
    You can declare a parameter of type `Response` in your *path operation function* (as you can do for cookies and headers).
    
    And then you can set the `status_code` in that *temporal* response object.
    
    ```Python hl_lines="1  9  12"
    {!../../../docs_src/response_change_status_code/tutorial001.py!}
    ```
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 1.5K bytes
    - Viewed (0)
  2. docs/es/docs/advanced/response-change-status-code.md

    Pero aún quieres poder filtrar y convertir los datos que retornas con un `response_model`.
    
    Para esos casos, puedes usar un parámetro `Response`.
    
    ## Usar un parámetro `Response`
    
    Puedes declarar un parámetro de tipo `Response` en tu *función de la operación de path* (como puedes hacer para cookies y headers).
    
    Y luego puedes establecer el `status_code` en ese objeto de respuesta *temporal*.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Feb 06 19:56:23 GMT 2024
    - 1.6K bytes
    - Viewed (0)
  3. docs/zh/docs/advanced/response-change-status-code.md

    # 响应 - 更改状态码
    
    你可能之前已经了解到,你可以设置默认的[响应状态码](../tutorial/response-status-code.md){.internal-link target=_blank}。
    
    但在某些情况下,你需要返回一个不同于默认值的状态码。
    
    ## 使用场景
    
    例如,假设你想默认返回一个HTTP状态码为“OK”`200`。
    
    但如果数据不存在,你想创建它,并返回一个HTTP状态码为“CREATED”`201`。
    
    但你仍然希望能够使用`response_model`过滤和转换你返回的数据。
    
    对于这些情况,你可以使用一个`Response`参数。
    
    ## 使用 `Response` 参数
    
    你可以在你的*路径操作函数*中声明一个`Response`类型的参数(就像你可以为cookies和头部做的那样)。
    
    然后你可以在这个*临时*响应对象中设置`status_code`。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Jun 10 20:30:28 GMT 2023
    - 1.4K bytes
    - Viewed (0)
  4. docs/em/docs/advanced/response-change-status-code.md

    👆 🎲 ✍ ⏭ 👈 👆 💪 ⚒ 🔢 [📨 👔 📟](../tutorial/response-status-code.md){.internal-link target=_blank}.
    
    ✋️ 💼 👆 💪 📨 🎏 👔 📟 🌘 🔢.
    
    ## ⚙️ 💼
    
    🖼, 🌈 👈 👆 💚 📨 🇺🇸🔍 👔 📟 "👌" `200` 🔢.
    
    ✋️ 🚥 💽 🚫 🔀, 👆 💚 ✍ ⚫️, & 📨 🇺🇸🔍 👔 📟 "✍" `201`.
    
    ✋️ 👆 💚 💪 ⛽ & 🗜 💽 👆 📨 ⏮️ `response_model`.
    
    📚 💼, 👆 💪 ⚙️ `Response` 🔢.
    
    ## ⚙️ `Response` 🔢
    
    👆 💪 📣 🔢 🆎 `Response` 👆 *➡ 🛠️ 🔢* (👆 💪 🍪 & 🎚).
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  5. okhttp/src/test/java/okhttp3/internal/http2/HttpOverHttp2Test.kt

        val response = call.execute()
    
        // Body contains nothing.
        assertThat(response.body.bytes().size).isEqualTo(0)
        assertThat(response.body.contentLength()).isEqualTo(0)
    
        // Content-Length header doesn't exist in a 204 response.
        assertThat(response.header("content-length")).isNull()
        assertThat(response.code).isEqualTo(204)
        val request = server.takeRequest()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 11 22:09:35 GMT 2024
    - 75.3K bytes
    - Viewed (0)
  6. docs/en/docs/reference/responses.md

    # Custom Response Classes - File, HTML, Redirect, Streaming, etc.
    
    There are several custom response classes you can use to create an instance and return them directly from your *path operations*.
    
    Read more about it in the [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/).
    
    You can import them directly from `fastapi.responses`:
    
    ```python
    from fastapi.responses import (
        FileResponse,
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/CacheTest.kt

            .build()
        val response1 = client.newCall(request).execute()
        response1.body.close()
        assertThat(response1.header("X-Response-ID")).isEqualTo("1")
        val response2 = get(url)
        response2.body.close()
        if (expectCached) {
          assertThat(response2.header("X-Response-ID")).isEqualTo("1")
        } else {
          assertThat(response2.header("X-Response-ID")).isEqualTo("2")
        }
      }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Apr 10 19:46:48 GMT 2024
    - 108.6K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/CallKotlinTest.kt

        val request = Request.Builder().url(server.url("/")).build()
    
        val response = client.newCall(request).execute()
    
        response.use {
          assertEquals(200, response.code)
          assertEquals(
            "CN=localhost",
            (response.handshake!!.peerCertificates.single() as X509Certificate).subjectDN.name,
          )
        }
      }
    
      private fun enableTls() {
        client =
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  9. okhttp/src/main/kotlin/okhttp3/ResponseBody.kt

     *
     * Both this class and [Response] implement [Closeable]. Closing a response simply
     * closes its response body. If you invoke [Call.execute] or implement [Callback.onResponse] you
     * must close this body by calling any of the following methods:
     *
     * * `Response.close()`
     * * `Response.body().close()`
     * * `Response.body().source().close()`
     * * `Response.body().charStream().close()`
     * * `Response.body().byteStream().close()`
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 10.7K bytes
    - Viewed (0)
  10. okhttp/src/test/java/okhttp3/InterceptorTest.kt

        }
        val request =
          Request.Builder()
            .url(server.url("/"))
            .build()
        val response = client.newCall(request).execute()
        assertThat(response.body.string()).isEqualTo("ABC")
        assertThat(response.header("OkHttp-Intercepted")).isEqualTo("yep")
        assertThat(response.header("Original-Header")).isEqualTo("foo")
      }
    
      @Test
      fun multipleApplicationInterceptors() {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Jan 14 10:20:09 GMT 2024
    - 27.8K bytes
    - Viewed (0)
Back to top