Description
In a Robyn 0.81.0 application with multiple POST/PATCH/PUT endpoints, request.json() works correctly for most handlers but silently fails or misbehaves for certain PATCH and PUT endpoints. The workaround is to use json.loads(request.body) instead, which always works.
Reproduction
from robyn import Robyn, Request, Response, ALLOW_CORS
import json
app = Robyn(__file__)
ALLOW_CORS(app, origins=["*"])
# This works fine
@app.post("/v1/alerts")
async def create_alert(request: Request) -> Response:
body = request.json() # ✅ works
return Response(status_code=200, description=json.dumps(body))
# This does NOT work reliably — request.json() returns unexpected results
@app.patch("/v1/orgs/billing")
async def update_billing(request: Request) -> Response:
body = request.json() # ❌ fails silently or returns wrong data
# Workaround:
body = json.loads(request.body) # ✅ always works
return Response(status_code=200, description=json.dumps(body))
# Same issue on PUT
@app.put("/v1/pricing")
async def update_pricing(request: Request) -> Response:
body = request.json() # ❌ same issue
body = json.loads(request.body) # ✅ workaround
return Response(status_code=200, description=json.dumps(body))
Observed behavior
request.json() works on POST endpoints but behaves inconsistently on PATCH/PUT endpoints in the same application.
json.loads(request.body) works correctly in all cases.
Expected behavior
request.json() should behave identically regardless of HTTP method.
Environment
- Robyn version: 0.81.0
- Python: 3.13
- OS: macOS (darwin 25.2.0)
Description
In a Robyn 0.81.0 application with multiple POST/PATCH/PUT endpoints,
request.json()works correctly for most handlers but silently fails or misbehaves for certain PATCH and PUT endpoints. The workaround is to usejson.loads(request.body)instead, which always works.Reproduction
Observed behavior
request.json()works on POST endpoints but behaves inconsistently on PATCH/PUT endpoints in the same application.json.loads(request.body)works correctly in all cases.Expected behavior
request.json()should behave identically regardless of HTTP method.Environment