fix: if header sent, don't set the cookie

bigpipe will fail
This commit is contained in:
fengmk2
2015-12-09 18:17:50 +08:00
parent 205a58f270
commit 629141717e
4 changed files with 27 additions and 13 deletions

View File

@@ -177,7 +177,8 @@ module.exports = function (app, options) {
locale = defaultLocale;
}
if (cookieLocale !== locale) {
// if header not send, set the locale cookie
if (cookieLocale !== locale && !this.headerSent) {
// locale change, need to set cookie
this.cookies.set(cookieField, locale, {
// make sure brower javascript can read the cookie