HappyX provides request models since v0.20.0
You could also saw request models in Fastapi
Model declaring π
model MyModel:
param1: string
param2: int = 100 # you can use default values π
Model usage π
get "/[m:MyModel]": # you can't use model as arg name because model is macro
echo m.param1
echo m.param2
req.answer { "response": {
"one": m.param1,
"two": m.param2
}}
And you can send GET request using Postman:
http://......./
with JSON body:
{
"param1": "123"
"param2": 2
}
Top comments (0)