/ justapi / benchmarks / workloads_body_test.py
swadhinbiswas WIP save-point: production hardening, H3 removal, fmt gate, and accumulated phase work · 7/15/2026
2080d40
37 lines · 607 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
29
30
31
32
33
34
35
36
37
from justapi import JustAPIApp
import json

app = JustAPIApp()


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


@app.post("/body_access")
def body_access(request):
    b = request["body"]
    return {"ok": True}


@app.post("/body_decode")
def body_decode(request):
    b = request["body"].decode("utf-8")
    return {"ok": True}


@app.post("/body_json")
def body_json(request):
    d = json.loads(request["body"].decode("utf-8"))
    return {"ok": True}


@app.post("/body_ret")
def body_ret(request):
    return request["body"]


if __name__ == "__main__":
    app.run("127.0.0.1:8242")