Skip to content

Commit

Permalink
docs: optimize egg-validate usage (#2852)
Browse files Browse the repository at this point in the history
  • Loading branch information
zoux authored and fengmk2 committed Aug 6, 2018
1 parent 422b342 commit 033fe0c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/source/en/tutorials/restful.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/source/zh-cn/tutorials/restful.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// 设置响应体和状态码
Expand Down

0 comments on commit 033fe0c

Please sign in to comment.