So I was working on better supporting Cookies in Athena responses and noticed that the current HTTP::Cookies type doesn’t support cookies with the same name, but different path/domains. This is because the internal hash is only keyed by the cookies name, when it should really be [domain][path][name].
Ok so I started messing around with an implementation for this and are some aspects that I didn’t think about that are going to make it trickier to implement.
#each method to get an Iterator
It’s not as simple as like @cookies.each_value anymore. Would probably want to make use of Iterator.chain consisting of an iterator for each [domain][path] hash
#to_h wouldn’t support multiple names
Technically would be a breaking change as it’ll no longer be a 1D hash
Prob some other stuff I didn’t run into yet.
I’m happy to continue figuring this out and make a PR, but think it would be worth seeing if this is something that is actually wanted first.
It’s actually really great for microservice architectures implemented via layer-7 load balancing (such as an ALB or K8s Ingress resource).
For example, if https://example.com/a and https://example.com/ routed to two different services, allowing multiple cookies to be set with the same name at different paths means that the two services don’t need to coordinate in order to avoid naming collisions.