Incorrect "Missing required parameter" error? #2323
-
I migrated this handler from FastAPI to Litestar. @post("/securitygroup")
async def security_group_create(
group_request: SecurityGroupRequest, # SecurityGroupRequest is a Pydantic model/class
x_ms_client_principal_id: Annotated[
str, Parameter(header="x-ms-client-principal-id")
],
x_ms_client_principal_name: Annotated[
str, Parameter(header="x-ms-client-principal-name")
],
request: Request,
) -> RequestResponse:
... It was working fine with FastAPI, but now I get a response
This is the request, with which it worked under FastAPI but now fails with Litestar: curl --location 'http://localhost:7071/securitygroup' \
--header 'x-ms-client-principal-name: DiegoS@test_HywWv.onmicrosoft.com' \
--header 'X-MS-CLIENT-PRINCIPAL-ID: cb1fd552-401d-4aea-ade0-6cbf5b747f80' \
--header 'Content-Type: application/json' \
--data-raw '{
"owner": "DiegoS@test_HywWv.onmicrosoft.com",
"deputy": "DiegoS@test_HywWv.onmicrosoft.com",
"display_name": "Cool New App!",
"description": "This app does something very cool!",
"mail_enabled": false,
"security_enabled": true
}' How do I fix it? |
Beta Was this translation helpful? Give feedback.
Answered by
Alc-Alc
Sep 20, 2023
Replies: 1 comment 1 reply
-
The request body variable has to always be
Does changing |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
danielniccoli
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The request body variable has to always be
data
as shown here.Does changing
group_request
todata
in the routesecurity_group_create
work?