forwardemail / forwardemail/supertest
[fix] SuperTest agents not sending cookies for Localhost domain cookies, you must set them to 127.0.0.1
- Dominant language
- JavaScript
- Stars
- 14.4k
- Forks
- 782
- PR merge metrics
- No merged PRs in 30d
Description
I'm unable to have the agent to automatically send my cookies to my requests after a successful login. What I don't undersand is that if try to set the cookies manually reading them from the agent itself it just works, but if i just remove the .set("Cookie") it stops working immediately. In my node express application, the very first thing I do is to setup cookieParser. It seems similar to the provided example on agents and cookies. The cookies are set as insecure already. Does the httpOnly flag of the cookies affect to this?
```
const app: Express = express();
app.use(cookieParser());
```
```
const response: Response = await myAgent.post("/post")
.field("description", "This is a test post.")
.field("price", "100")
.set(
"Cookie",
myAgent.jar.getCookies({
domain: "localhost",
path: "/",
secure: false,
script: false,
})
.at(0)!
.toString()
)
.redirects(5);
```
Contributor guide
Assessment
This issue has not been assessed yet.