Skip to content

Commit

Permalink
Add failing test for issue ladjs#1760
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonjackson committed Jan 24, 2023
1 parent bc627ea commit dbec926
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/node/redirects.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ describe('request', () => {
});
});

it('should overwrite previously set cookie during a redirect when agent is used', (done) => {
const agent = request.agent();
agent.get(`${base}/set-cookie`).end((error) => {
assert.ifError(error);
agent
.get(`${base}/cookie-redirect`)
.redirects(1)
.end((error, res) => {
assert.ifError(error);
assert(/replaced=yes/.test(res.text), 'replaced=yes');
});
});
})

it('should follow Location', (done) => {
const redirects = [];

Expand Down
1 change: 1 addition & 0 deletions test/support/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ app.get('/cookie-redirect', (request, res) => {
});

app.get('/set-cookie', (request, res) => {
res.cookie('replaced', 'no')
res.cookie('persist', '123');
res.send('ok');
});
Expand Down

0 comments on commit dbec926

Please sign in to comment.