Describe the bug
I use superagent.agent() to run several requests. The cookies from set-cookies are sent to all domains without checking if the domain is the one that the set-cookie returned from.
Actual behavior
I send a request to httpbin.org that returns a header with set-cookie and then send a request to google.com and the cookie from httpbin is sent to google as well
Expected behavior
The cookie of google request should be empty
Code to reproduce
const superagent = require("superagent")
const request = superagent.agent();
const cookie = encodeURIComponent('_ga=s%3ACcsRO5I9SasTzV;Path=/;Expires=Sat,07Jan202313:53:43GMT')2023 13:53:43 GMT')
await request.get(`http://httpbin.org/response-headers?set-cookie=${cookie}`);
request.get('https://google.com').cookies;
This pull request solves that issue: #1757
Checklist
Describe the bug
I use
superagent.agent()to run several requests. The cookies fromset-cookiesare sent to all domains without checking if the domain is the one that theset-cookiereturned from.Actual behavior
I send a request to
httpbin.orgthat returns a header withset-cookieand then send a request togoogle.comand the cookie fromhttpbinis sent togoogleas wellExpected behavior
The cookie of google request should be empty
Code to reproduce
This pull request solves that issue: #1757
Checklist