diff --git a/docs/source/en/tutorials/restful.md b/docs/source/en/tutorials/restful.md index 0f077e3bea..6a3cd19f22 100644 --- a/docs/source/en/tutorials/restful.md +++ b/docs/source/en/tutorials/restful.md @@ -155,7 +155,7 @@ class TopicController extends Controller { const ctx = this.ctx; // validate the `ctx.request.body` with the expected format // status = 422 exception will be thrown if not passing the parameter validation - ctx.validate(createRule); + ctx.validate(createRule, ctx.request.body); // call service to create a topic const id = await ctx.service.topics.create(ctx.request.body); // configure the response body and status code diff --git a/docs/source/zh-cn/tutorials/restful.md b/docs/source/zh-cn/tutorials/restful.md index 2e91a80878..119ba0d574 100644 --- a/docs/source/zh-cn/tutorials/restful.md +++ b/docs/source/zh-cn/tutorials/restful.md @@ -156,7 +156,7 @@ class TopicController extends Controller { const ctx = this.ctx; // 校验 `ctx.request.body` 是否符合我们预期的格式 // 如果参数校验未通过,将会抛出一个 status = 422 的异常 - ctx.validate(createRule); + ctx.validate(createRule, ctx.request.body); // 调用 service 创建一个 topic const id = await ctx.service.topics.create(ctx.request.body); // 设置响应体和状态码