【问题标题】:Can HTTP response body be empty when response header 'Content-Type' is set to 'application/json'?当响应标头“Content-Type”设置为“application/json”时,HTTP 响应正文可以为空吗?
【发布时间】:2016-06-30 16:12:18
【问题描述】:

这是否根据规范允许,还是必须返回有效的 JSON([]{})?

【问题讨论】:

    标签: javascript json http http-headers specifications


    【解决方案1】:

    有效的 JSON (RFC 7159) 可能只是 JS 值(请参阅https://greenbytes.de/tech/webdav/rfc7159.html#values)。

    但是不,根据媒体类型,空有效负载将无效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-07
      • 2019-12-19
      • 1970-01-01
      • 2015-04-17
      • 2022-06-25
      • 1970-01-01
      • 2013-01-20
      相关资源
      最近更新 更多