Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for 4XX (0.01 sec)

  1. docs/zh/docs/tutorial/handling-errors.md

    某些情况下,需要向客户端返回错误提示。
    
    这里所谓的客户端包括前端浏览器、其他应用程序、物联网设备等。
    
    需要向客户端返回错误提示的场景主要如下:
    
    - 客户端没有执行操作的权限
    - 客户端没有访问资源的权限
    - 客户端要访问的项目不存在
    - 等等 ...
    
    遇到这些情况时,通常要返回 **4XX**(400 至 499)**HTTP 状态码**。
    
    **4XX** 状态码与表示请求成功的 **2XX**(200 至 299) HTTP 状态码类似。
    
    只不过,**4XX** 状态码表示客户端发生的错误。
    
    大家都知道**「404 Not Found」**错误,还有调侃这个错误的笑话吧?
    
    ## 使用 `HTTPException`
    
    向客户端返回 HTTP 错误响应,可以使用 `HTTPException`。
    
    ### 导入 `HTTPException`
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Oct 11 17:48:49 UTC 2025
    - 8.2K bytes
    - Viewed (0)
  2. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/http/CallServerInterceptor.kt

            // If there's a "Expect: 100-continue" header on the request, wait for a "HTTP/1.1 100
            // Continue" response before transmitting the request body. If we don't get that, return
            // what we did get (such as a 4xx response) without ever transmitting the request body.
            if ("100-continue".equals(request.header("Expect"), ignoreCase = true)) {
              exchange.flushRequest()
    Registered: Fri Dec 26 11:42:13 UTC 2025
    - Last Modified: Thu Oct 30 13:46:58 UTC 2025
    - 7.6K bytes
    - Viewed (0)
  3. fastapi/utils.py

            return True
        # Ref: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#patterned-fields-1
        if status_code in {
            "default",
            "1XX",
            "2XX",
            "3XX",
            "4XX",
            "5XX",
        }:
            return True
        current_status_code = int(status_code)
        return not (current_status_code < 200 or current_status_code in {204, 205, 304})
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 5.1K bytes
    - Viewed (0)
  4. fastapi/openapi/utils.py

                "items": {"$ref": REF_PREFIX + "ValidationError"},
            }
        },
    }
    
    status_code_ranges: dict[str, str] = {
        "1XX": "Information",
        "2XX": "Success",
        "3XX": "Redirection",
        "4XX": "Client Error",
        "5XX": "Server Error",
        "DEFAULT": "Default Response",
    }
    
    
    def get_openapi_security_definitions(
        flat_dependant: Dependant,
    ) -> tuple[dict[str, Any], list[dict[str, Any]]]:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 23.2K bytes
    - Viewed (0)
  5. docs/en/docs/release-notes.md

    ## 0.85.1
    
    ### Fixes
    
    * 🐛 Fix support for strings in OpenAPI status codes: `default`, `1XX`, `2XX`, `3XX`, `4XX`, `5XX`. PR [#5187](https://github.com/tiangolo/fastapi/pull/5187) by [@JarroVGIT](https://github.com/JarroVGIT).
    
    ### Docs
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 19:06:15 UTC 2025
    - 586.7K bytes
    - Viewed (0)
Back to top