Skip to content

Commit

Permalink
docs: correct sample codes (#1434)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jawnkuin authored and dead-horse committed Sep 19, 2017
1 parent 6eac07e commit d0797b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions docs/source/en/basics/controller.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ module.exports = class UploaderController extends Controller {
result = yield ctx.oss.put('egg-multipart-test/' + part.filename, part);
} catch (err) {
// must consume the file stream, or the browser will get stuck
yield sendToWormhole(stream);
yield sendToWormhole(part);
throw err;
}
console.log(result);
Expand Down Expand Up @@ -501,15 +501,15 @@ const Controller = require('egg').Controller;
module.exports = class CookieController extends Controller {
* add() {
const ctx = this.ctx;
const count = ctx.cookie.get('count');
const count = ctx.cookies.get('count');
count = count ? Number(count) : 0;
ctx.cookie.set('count', ++count);
ctx.cookies.set('count', ++count);
ctx.body = count;
}

* remove() {
const ctx = this.ctx;
const count = ctx.cookie.set('count', null);
const count = ctx.cookies.set('count', null);
ctx.status = 204;
}
};
Expand Down
8 changes: 4 additions & 4 deletions docs/source/zh-cn/basics/controller.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ module.exports = class UploaderController extends Controller {
result = yield ctx.oss.put('egg-multipart-test/' + part.filename, part);
} catch (err) {
// 必须将上传的文件流消费掉,要不然浏览器响应会卡死
yield sendToWormhole(stream);
yield sendToWormhole(part);
throw err;
}
console.log(result);
Expand Down Expand Up @@ -514,15 +514,15 @@ const Controller = require('egg').Controller;
module.exports = class CookieController extends Controller {
* add() {
const ctx = this.ctx;
const count = ctx.cookie.get('count');
const count = ctx.cookies.get('count');
count = count ? Number(count) : 0;
ctx.cookie.set('count', ++count);
ctx.cookies.set('count', ++count);
ctx.body = count;
}

* remove() {
const ctx = this.ctx;
const count = ctx.cookie.set('count', null);
const count = ctx.cookies.set('count', null);
ctx.status = 204;
}
};
Expand Down

0 comments on commit d0797b1

Please sign in to comment.