forwardemail / forwardemail/supertest

Parses set-cookie header differently than superagent when run inside jest

Open
#460 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
14.4k
Forks
782
PR merge metrics
No merged PRs in 30d

Description

Hi folks, I've got quite a peculiar bug that I've isolated in [this repo](https://github.com/timwis/testcase-superagent-multiple-cookies). My server (koa) returns two `set-cookie` headers. When run standalone, both superagent and supertest parse the two `set-cookie` headers into separate items in an array.
```bash
node request.js

supertest [ 'koa:sess=foo; path=/; httponly',
'koa:sess.sig=E3XmR2LMmP11O418i_oXS61zGi0; path=/; httponly' ]
superagent [ 'koa:sess=foo; path=/; httponly',
'koa:sess.sig=E3XmR2LMmP11O418i_oXS61zGi0; path=/; httponly' ]
```

When run in the context of jest, supertest behaves differently, combining the two `set-cookie` headers.
```bash
npm test

superagent [ 'koa:sess=foo; path=/; httponly',
'koa:sess.sig=E3XmR2LMmP11O418i_oXS61zGi0; path=/; httponly' ]
supertest [ 'koa:sess=foo; path=/; httponly,koa:sess.sig=E3XmR2LMmP11O418i_oXS61zGi0; path=/; httponly' ]
```

The [repo](https://github.com/timwis/testcase-superagent-multiple-cookies) has a reproduction. Any idea how this could be happening? Am I crazy?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.