mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-30 09:39:20 -05:00
Co-authored-by: Yurii Motov <yurii.motov.monte@gmail.com> Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
13 lines
344 B
Python
13 lines
344 B
Python
from fastapi import FastAPI
|
|
from fastapi.responses import JSONResponse
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.post("/cookie/")
|
|
def create_cookie():
|
|
content = {"message": "Come to the dark side, we have cookies"}
|
|
response = JSONResponse(content=content)
|
|
response.set_cookie(key="fakesession", value="fake-cookie-session-value")
|
|
return response
|