Skip to content
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

Make res.set() work like express when passed an object #33

Merged
merged 2 commits into from
Mar 5, 2015

Conversation

gmaclennan
Copy link
Contributor

The Express res.set() accepts an object as an argument to set headers. This PR should copy that functionality from Express.

@howardabrams
Copy link
Collaborator

Interesting addition. Can you write a test to validate this change?

Thanks a lot!

@gmaclennan
Copy link
Contributor Author

Added a test. This does, however, introduce a breaking change. Previously mockResponse.header() was an alias of either getHeader or setHeader depending on the amount of passed parameters, but this change sets it as an alias to mockResponse.set(), which mimics express. I'm not sure where mockResponse.header() would be used by anyone, because as it was it was not an Express method or a standard node.http method. Mocking Express seems to make more sense.

@howardabrams
Copy link
Collaborator

I think you are correct. Shortcut aliases like this seems like a bad idea now.

howardabrams added a commit that referenced this pull request Mar 5, 2015
Make res.set() work like express when passed an object
@howardabrams howardabrams merged commit 6ad9d2a into eugef:master Mar 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants