Coverage for docs_src/response_cookies/tutorial001.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-08-08 03:53 +0000

1from fastapi import FastAPI 1abcde

2from fastapi.responses import JSONResponse 1abcde

3 

4app = FastAPI() 1abcde

5 

6 

7@app.post("/cookie/") 1abcde

8def create_cookie(): 1abcde

9 content = {"message": "Come to the dark side, we have cookies"} 1abcde

10 response = JSONResponse(content=content) 1abcde

11 response.set_cookie(key="fakesession", value="fake-cookie-session-value") 1abcde

12 return response 1abcde