forked from grpc-ecosystem/grpc-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for writing Etag headers and handling If-None-Match req…
…uest headers * Taken from https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag: "The ETag (or entity tag) HTTP response header is an identifier for a specific version of a resource. It lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content was not changed." * This feature is enabled by passing in the WithEnableEtagSupport option when creating the mux * The Etag is only written for GET requests with messages greater than 100 bytes and is set to the md5 hash of the message. * If a client sends the If-None-Match request header, the server will compare that value to the calculated etag. If they match, it will return http.StatusNotModified (304) and not write the message in the response. * Added a test to ensure the correct headers are being returned when the option is set and that If-None-Match works.
- Loading branch information
1 parent
da60ed9
commit d1499d3
Showing
3 changed files
with
114 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters