Skip to content

Commit

Permalink
docs: multipart example use yield parts() (#1518)
Browse files Browse the repository at this point in the history
  • Loading branch information
dead-horse authored and popomore committed Oct 12, 2017
1 parent 6846bad commit 7b37d23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/source/en/basics/controller.md
Expand Up @@ -365,7 +365,8 @@ module.exports = class UploaderController extends Controller {
const ctx = this.ctx;
const parts = ctx.multipart();
let part;
while ((part = yield parts) != null) {
// parts() return a promise
while ((part = yield parts()) != null) {
if (part.length) {
// it is field in case of arrays
console.log('field: ' + part[0]);
Expand Down
3 changes: 2 additions & 1 deletion docs/source/zh-cn/basics/controller.md
Expand Up @@ -378,7 +378,8 @@ module.exports = class UploaderController extends Controller {
const ctx = this.ctx;
const parts = ctx.multipart();
let part;
while ((part = yield parts) != null) {
// parts() return a promise
while ((part = yield parts()) != null) {
if (part.length) {
// 濡傛灉鏄暟缁勭殑璇濇槸 filed
console.log('field: ' + part[0]);
Expand Down

0 comments on commit 7b37d23

Please sign in to comment.