Disable Etag response header for GET /protocol-version#45
Disable Etag response header for GET /protocol-version#45jasonrudolph wants to merge 4 commits intomasterfrom
GET /protocol-version#45Conversation
|
/fyi @as-cii: Here's a potential solution for removing the ETag response header from |
- Add tests for the middleware introduced in 17947a1 - Refactor TestServer to extract out the logic for starting and destroying an HTTP test server for an Express app. This refactoring allows us to create a tiny Express app to test the `disableResponseHeaders` middleware. (I started out by attempting to unit test the `disableResponseHeaders` middleware using the stub-based approach that we used for the other middlewares, but it that approach would have required quite a bit of fragile stubbing to stub out all the necessary parts of the request and response. Ultimately, it feels more robust and more maintainable to test the middleware by using it in a small Express app and testing the middleware's effects on that app.)
GET /protocol-versionGET /protocol-version
|
@as-cii: I think this is ready for code review. Would you mind reviewing it when you have a moment? It's probably easiest to review the individual commits, where each commit message explains the specific change that's taking place. I'm especially curious to hear your thoughts on the changes to |
as-cii
left a comment
There was a problem hiding this comment.
Looks good to me. After a quick search it seems like another option would be to add a Cache-Control: no-store header to the response (see expressjs/express#2472). For instance:
app.get('/protocol-version', function (req, res) {
res.set('Cache-Control', 'no-store')
res.send({version: 7})
})If we make it less general by using the approach above we may even consider avoiding to write tests at all for this particular behavior as it's pretty declarative already. What do you think?
|
Closing in favor of #47. |
Motivation: atom/teletype#318 (comment)
TODO
ETagresponse header forGET /protocol-versionDemo
Before
After