BREAKING CHANGE(request): introduce lazy request body parsing via ctx.json()/text()/arrayBuffer()/formData and remove IRequestContext.body

This commit is contained in:
2025-12-20 06:55:47 +00:00
parent 39f0cdf380
commit 4a17bf39c6
9 changed files with 191 additions and 65 deletions

View File

@@ -95,11 +95,12 @@ class OpenApiUserController {
})
@ApiResponseBody(201, { description: 'User created', schema: UserSchema })
@ApiResponseBody(400, { description: 'Validation error' })
createUser(ctx: IRequestContext<{ name: string; email: string }>) {
async createUser(ctx: IRequestContext<{ name: string; email: string }>) {
const body = await ctx.json();
return {
id: 'new-uuid',
name: ctx.body.name,
email: ctx.body.email,
name: body.name,
email: body.email,
};
}