koa: this.cookies.set() cannot set cookie to chrome correctly

I came across a strange scene.

In the entry js file:

app.use(function*(next) {
    this.cookies.set('test', 999999);
    return yield next;
})

This is ok in both HTTP Response Header and Chrome Devtool Resources 's Cookies.

But…

When I put the this.cookies.set to Get Reponser

app.get('/v1/test', function *(next) {
    this.cookies.set('test1', 66666);
    this.body = { code: 200, message: 'success'}
    return yield next;
})

The HTTP Reponse Header is ok

Set-Cookie: test1=66666; path=/; httponly

The Chrome Devtool Resources’s Cookies display no cookie !

I have debugg this for long time, please help me ~

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 21 (9 by maintainers)

Most upvoted comments

@freestyle21 @dead-horse I think the issue aims at receiving cookies problem, not sending. If i’m wrong, correct me.