Cookies don't send after redirect
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.6k
- Forks
- 237
- PR merge metrics
- No merged PRs in 30d
Description
const options = {
follow_set_cookies: true,
cookies: {
test: new Date().valueOf()
}
};
const response = await needle('GET', 'https://setcookie.net/', undefined, options);
console.log(response.body.match(/<code>(.+)<\/code>/i)?.[1]);
const response2 = await needle('GET', 'https://shorturl.at/BQUI3', undefined, options);
console.log(response2.body.match(/<code>(.+)<\/code>/i)?.[1]);
The example can looks strange but in real case it's a redirect from www.host.com to host.com
It was broken in 3.1.0 after had added the challenge host_and_ports_match
https://github.com/tomas/needle/blob/9454d7bdc94b5a9a9c8f60eafefb6408f83a9a37/lib/needle.js#L542-L553
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the redirect cookie handling in lib/needle.js at the host_and_ports_match challenge referenced in the issue, then reproduce the two requests against setcookie.net and shorturl.at. Confirm the redirect from www.host.com to host.com preserves the configured and received cookies without regressing host or port checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100