workers-rs
workers-rs copied to clipboard
[BUG] set-cookie twice / header folds
Is there an existing issue for this?
- [X] I have searched the existing issues
What version of workers-rs are you using?
0.0.18
What version of wrangler are you using?
0.0.18
Describe the bug
When calling a cloudflare worker in workers-rs, the set-cookie header "folds" and creates a single set-cookie = cookie1=value1, cookie2=value2.
According to cloudflare docs and the IETF RFC, the set-cookie header should not fold.
We do not have the same behaviour in our javascript workers.
It's a tricky case when looking at the headers interface, but maybe a similar getAll interface is needed here?
This makes it slightly more tricky to act as a reverse-proxy and forward requests from our worker.
Steps To Reproduce
- Make a cf workers-rs worker
- Log request.headers
-
curl -H "Set-Cookie: cookie1=value1" -H "Set-Cookie: cookie2=value2" http://0.0.0.0:8787 - Observe
set-cookie = cookie1=value1, cookie2=value2
Should I implement the get_all function in Headers (headers.rs) with the following specification?
Return all values of the `Set-Cookie` header in the `Headers` object with
Returns them as a Result<Vec<String>> type.
Also return an error if the name is not `Set-Cookie`.