expressjs / expressjs/expressjs.com

Possible gap in documentation re res.json and res.jsonp

Open
#1,330 5 comments 0 reactions 0 assignees View on GitHub
docs question
Dominant language
MDX
Stars
5.4k
Forks
2.3k
Avg merge
2d 23m
Merged PRs (30d)
14

Description

The documentation for 4.x, under res.jsonp() says, "res.jsonp([body])
Sends a JSON response with JSONP support. This method is identical to res.json(), except that it opts-in to JSONP callback support."

It appears that part of res.jsonp involves changing the content-type from 'application/json' to 'text/javascript'. I understand why this happens (RFC JSON Schema), but is there a setting or other way to keep the 'incorrect' content-type? Otherwise, maybe amend the documentation to note all the ways in which res.jsonp differs from res.json.
Thanks for considering it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.