-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Remove res.vary() (no arguments) signature #2943
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
Conversation
The vary module already does this check and throw, no? |
It does throw if |
Happy to remove the check/throw or change it if it is still good to test if |
Yea, the idea behind the change is to remove any logic from Express itself, and just have it pass-through to the dependency. |
2dd248a
to
f5bde96
Compare
OK, updates. I've removed the test that passes an empty array and kept the no args test. I think that's ok, but I'm happy to either remove the no args or add a test for empty array that checks it has no effect, if that fits better. |
Yea, let's keep the test, but update the expected outcome to what it is with the change. |
f5bde96
to
447d813
Compare
OK, done. |
447d813
to
bd2fc86
Compare
|
bd2fc86
to
0f34edb
Compare
@tunniclm coverage has decreased by a fraction, otherwise looks good to me. |
As mentioned in the other similar pull request (see #2939 (comment)), the slight reduction in coverage is due to the reduced number of lines in the changed file (response.js). |
@@ -5,7 +5,7 @@ var request = require('supertest'); | |||
|
|||
describe('res.vary()', function(){ | |||
describe('with no arguments', function(){ | |||
it('should not set Vary', function (done) { | |||
it('should error missing field', function (done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add this as an additional test rather than altering the existing test? I think both the former test and the test you changed it to have merit and would like to have both.
Hi @tunniclm, can you address the comment regarding the test and possibly rebase this pull request? Then I think everything is resolved to merge after that. |
0f34edb
to
56e6bba
Compare
Updated. |
Merged into the 5.0 branch. |
Changed
res.vary()
to throwTypeError
if nofield
argument is passed or if the value offield
argument is an empty array. (Similar to howres.sendFile()
deals with a missingpath
argument).