Best content type to serve JSONP?

前端 未结 2 967
清酒与你
清酒与你 2020-11-27 11:34

I have a webservice that when called without specifying a callback will return a JSON string using application/json as the content type.

When a callback

相关标签:
2条回答
  • 2020-11-27 12:01

    Use application/javascript. In that way, clients can rely on the content-type without having to manually check whether a response has padding or not.

    0 讨论(0)
  • 2020-11-27 12:13

    Use application/json as per rfc4627.txt if what you return is plain JSON.

    If you return JavaScript (which is really what JSONP is), then use application/javascript as per rfc4329.txt

    0 讨论(0)
提交回复
热议问题