/ justapi / benchmarks / workloads_fastapi.py
swadhinbiswas WIP save-point: production hardening, H3 removal, fmt gate, and accumulated phase work · 7/15/2026
a293d8c
28 lines · 442 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from fastapi import FastAPI, Request
from pydantic import BaseModel
import json

app = FastAPI()


class Item(BaseModel):
    id: int
    name: str
    price: float


@app.post("/body_json")
async def body_json(request: Request):
    data = json.loads(await request.body())
    return {"ok": True}


@app.post("/validate")
async def validate(item: Item):
    return {"ok": True}


@app.post("/noop")
async def noop():
    return {"ok": True}