Response Headers #1247
-
Hi, I want to use ETags to avoid mid-air-collisions. During get requests the response should have an ETag header, so that a subsequent update request with contain that value in an ETag request header. The value of the ETag will come from the service layer which is invoked by the Endpoint. I am using a grpc transport, and ServeGRPC does not provide a way for me to pass the value back from the Endpoint response. How should I get a value from the service layer into a response header using grpc transport? Should the context be returned from Endpoint or should there be another server after middleware that takes the response from the Endpoint? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 14 replies
-
AFAIK, and please correct me if I'm mistaken, gRPC headers are comparable to, but not the same as, HTTP headers. Is there some prior art here? I would generally expect this to be solvable via SetResponseHeader. |
Beta Was this translation helpful? Give feedback.
-
It's also worth noting that ETags by themselves don't solve this (or any) problem, it's only when they're combined with a caching middlebox that knows how to parse them that they have any effect. And it is IME rare that ETags make sense for Go kit applications — the caching/versioning semantics of HTTP are not usually a good match for the requirements of typical microservices. |
Beta Was this translation helpful? Give feedback.
-
Not directly visible here unless expanding the thread above is the actual answer how to solve this problem by @peterbourgon: |
Beta Was this translation helpful? Give feedback.
Not directly visible here unless expanding the thread above is the actual answer how to solve this problem by @peterbourgon:
#1247 (reply in thread)