-
Notifications
You must be signed in to change notification settings - Fork 50
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
Consider adding metadata property #3
Comments
Yes please! When I implemented this in my own code, I used a protocol-based approach like SwiftUI's |
I don’t think putting metadata on the request object here is appropriate. The request object represents a HTTP request, not a request plus arbitrary context. It seems more appropriate for that combination to be separate from the specifics of this type. If it isn’t semantically part of the type, it shouldn’t be here, IMO. |
I agree with @Lukasa here. These types should be the raw representation of the specs and provide a common set of types that we can share across the various frameworks and platforms. Adding arbitrary metadata or extracting common metadata from headers should be handled at a higher level like Vapor or Hummingbird. |
Speaking from experience. NSURLRequest supported custom properties through NSURLProtocol, and it has caused us a few headaches over the years:
Yes, having extra metadata is often useful, but there should be a better way to achieve this than having |
There are many use cases where you may want to store some metadata on the request or even response (for example storing a request ID or a trace ID for distributed systems). Currently there's no way to do this, without adding an additional header which may not be desirable, or a pseudo header which feels like it's working around the problem rather than solving it.
Would a dictionary property or similar be something the team would consider?
The text was updated successfully, but these errors were encountered: