当响应头'Content-Type'设置为'application/json'时HTTP响应体可以为空吗?

Can HTTP response body be empty when response header 'Content-Type' is set to 'application/json'?

根据规范这是允许的,还是必须 return 一个有效的 JSON([]{})?

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

但是不行,根据媒体类型,空的有效载荷是无效的。