New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure clones of Request are deep clones #218
Conversation
The requirement that attributes be serializable makes me rather uncomfortable. This would be a no-go in http-server, so I'm not sure I want to have that kind of restriction in http-client. |
Our HTTP server doesn't have any retry mechanism. I thought about it pretty much a whole day and this seems to be the only viable solution to do retries to me. |
Do we want to revert |
I thought about that as well, but it doesn't solve the problem with attributes, because we can't ensure they're immutable. We'd have to deeply clone them like in this solution. This solution has the added benefit that request and response APIs are aligned without response being not really immutable (if we'd change that back, too). It's basically the best of both worlds, with the only drawback being a slight performance penalty for attributes, but those shouldn't be used too often. |
Yes – attributes were the reason I didn't like the request being immutable since they weren't really immutable. With this solution, the request could truly be immutable again. Request headers are still mutable, which I thought was your original concern – |
They're mutable, yes, but as the request object is required to be cloned at every layer, mutability isn't a problem anymore. |
Requiring cloning is easy to enforce in our code, but I'd be surprised if user interceptors would always remember to clone the request. |
That's the exact reason why |
Ok, enforcing that in the client is a much lower bar that I'm more comfortable with. Looks like we need to add |
All properties are either immutable for deep clones now. Fixes #216.
We can consider re-adding it in the future.
This allows the connection to modify the request, e.g. add timing information.
All properties are either immutable for deep clones now.
Fixes #216.