- Sort Score
- Num 10 results
- Language All
Results 31 - 40 of 464 for status_code (0.21 seconds)
-
docs_src/response_change_status_code/tutorial001_py310.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 391 bytes - Click Count (0) -
docs/zh-hant/docs/tutorial/response-status-code.md
就像你可以指定回應模型一樣,你也可以在任一個「路徑操作(path operation)」的參數 `status_code` 中宣告回應所使用的 HTTP 狀態碼: * `@app.get()` * `@app.post()` * `@app.put()` * `@app.delete()` * 等等 {* ../../docs_src/response_status_code/tutorial001_py310.py hl[6] *} /// note | 注意 請注意,`status_code` 是「裝飾器(decorator)」方法(`get`、`post` 等等)的參數,而不是你的「路徑操作函式」的參數,就像所有的參數與 body 一樣。 /// 參數 `status_code` 接受一個數字作為 HTTP 狀態碼。 /// info | 資訊
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 3.7K bytes - Click Count (0) -
docs_src/response_status_code/tutorial002_py310.py
from fastapi import FastAPI, status app = FastAPI() @app.post("/items/", status_code=status.HTTP_201_CREATED) async def create_item(name: str):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 173 bytes - Click Count (0) -
fastapi/routing.py
# normalize enums e.g. http.HTTPStatus if isinstance(status_code, IntEnum): status_code = int(status_code) self.status_code = status_code if self.response_model: assert is_body_allowed_for_status_code(status_code), ( f"Status code {status_code} must not have a response body" ) response_name = "Response_" + self.unique_idCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 193K bytes - Click Count (0) -
docs_src/custom_response/tutorial006c_py310.py
from fastapi import FastAPI from fastapi.responses import RedirectResponse app = FastAPI() @app.get("/pydantic", response_class=RedirectResponse, status_code=302) async def redirect_pydantic():
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 237 bytes - Click Count (0) -
docs_src/additional_responses/tutorial001_py310.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 506 bytes - Click Count (0) -
docs_src/sql_databases/tutorial001_an_py310.py
hero = session.get(Hero, hero_id) if not hero: raise HTTPException(status_code=404, detail="Hero not found") return hero @app.delete("/heroes/{hero_id}") def delete_hero(hero_id: int, session: SessionDep): hero = session.get(Hero, hero_id) if not hero: raise HTTPException(status_code=404, detail="Hero not found") session.delete(hero) session.commit()
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Oct 09 19:44:42 GMT 2024 - 1.7K bytes - Click Count (0) -
docs_src/path_operation_configuration/tutorial001_py310.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 04 12:07:26 GMT 2026 - 350 bytes - Click Count (0) -
docs_src/dependencies/tutorial008c_py310.py
if item_id == "portal-gun": raise InternalError( f"The portal gun is too dangerous to be owned by {username}" ) if item_id != "plumbus": raise HTTPException( status_code=404, detail="Item not found, there's only a plumbus here" )Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 660 bytes - Click Count (0) -
tests/test_dependency_after_yield_raise.py
response = client.get("/broken") assert response.status_code == 200 assert response.json() == {"message": "all good?"} def test_broken_return_finishes(): client = TestClient(app, raise_server_exceptions=False) response = client.get("/broken") assert response.status_code == 200
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 1.7K bytes - Click Count (0)