Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

res.json overrides res.type #1349

Closed
benw opened this Issue Sep 26, 2012 · 3 comments

Comments

Projects
None yet
2 participants

benw commented Sep 26, 2012

res.type('application/vnd.example+json');
res.json({'hello': 'world'});

Content-Type: application/json; charset=utf-8

I would like res.json (and res.send) to leave Content-Type alone if it has already been set. Thanks. :)

Owner

tj commented Sep 26, 2012

+1 I'll patch tomorrow

@tj tj closed this in 0d3a637 Sep 26, 2012

Owner

tj commented Sep 26, 2012

res.send() already has this. thanks for the report!

benw commented Sep 27, 2012

Thanks! Looks like res.send calls res.json when body is an object, so I think you've fixed them both now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment