Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 252 for Response (0.22 sec)

  1. docs/en/docs/reference/response.md

    # `Response` class
    
    You can declare a parameter in a *path operation function* or dependency to be of type `Response` and then you can set data for the response like headers or cookies.
    
    You can also use it directly to create an instance of it and return it from your *path operations*.
    
    You can import it directly from `fastapi`:
    
    ```python
    from fastapi import Response
    ```
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 397 bytes
    - Viewed (0)
  2. docs/zh/docs/advanced/response-headers.md

    你也可以在直接返回`Response`时添加头部。
    
    按照[直接返回响应](response-directly.md){.internal-link target=_blank}中所述创建响应,并将头部作为附加参数传递:
    ```Python hl_lines="10-12"
    {!../../../docs_src/response_headers/tutorial001.py!}
    ```
    
    
    !!! note "技术细节"
        你也可以使用`from starlette.responses import Response`或`from starlette.responses import JSONResponse`。
    
        **FastAPI**提供了与`fastapi.responses`相同的`starlette.responses`,只是为了方便开发者。但是,大多数可用的响应都直接来自Starlette。
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 2K bytes
    - Viewed (0)
  3. docs/fr/docs/advanced/response-directly.md

    Cela peut être utile, par exemple, pour retourner des en-têtes personnalisés ou des cookies.
    
    ## Renvoyer une `Response`
    
    En fait, vous pouvez retourner n'importe quelle `Response` ou n'importe quelle sous-classe de celle-ci.
    
    !!! note "Remarque"
        `JSONResponse` est elle-même une sous-classe de `Response`.
    
    Et quand vous retournez une `Response`, **FastAPI** la transmet directement.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  4. docs/en/docs/advanced/custom-response.md

        Of course, the actual `Content-Type` header, status code, etc, will come from the `Response` object you returned.
    
    ### Document in OpenAPI and override `Response`
    
    If you want to override the response from inside of the function but at the same time document the "media type" in OpenAPI, you can use the `response_class` parameter AND return a `Response` object.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.7K bytes
    - Viewed (0)
  5. 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)
  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. 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 Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/internal/http2/HttpOverHttp2Test.kt

              call: Call,
              response: Response,
            ) {
              responses.offer(response.body.string())
            }
          }
    
        // Make the first request waiting until we get our auth challenge.
        val request = Request(server.url("/"))
        blockingAuthClient.newCall(request).enqueue(callback)
        val response1 = responses.take()
        assertThat(response1).isEqualTo("")
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Thu Apr 11 22:09:35 GMT 2024
    - 75.3K bytes
    - Viewed (0)
  9. 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 Apr 26 11:42:10 GMT 2024
    - Last Modified: Wed Apr 10 19:46:48 GMT 2024
    - 108.6K bytes
    - Viewed (0)
  10. okhttp/src/test/java/okhttp3/CallTest.kt

        server.enqueue(MockResponse(body = "response that will never be received"))
        val response = executeSynchronously("/")
        response.assertFailure(
          // JDK 11 response to the FAIL_HANDSHAKE:
          SSLException::class.java,
          // RI response to the FAIL_HANDSHAKE:
          SSLProtocolException::class.java,
          // Android's response to the FAIL_HANDSHAKE:
          SSLHandshakeException::class.java,
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Wed Apr 10 19:46:48 GMT 2024
    - 142.5K bytes
    - Viewed (0)
Back to top