2016-03-01 21:47
浏览 94

如何强制204 rest API返回内容?

I know that 204 means that the server has understood the request but there is no content available. But I think is wrong prevent to the developer return a json message like this:
return json_encode(array("mex" => "no content"));

What I need is return also a json when the API return 204 in the header. I don't want use 200 in this case 'cause this means that there is a content returned.

Also the 404 is not appropriate 'cause this means the resource doesn't exits.
Anyidea to do this?
This is my code:

return json_encode(array("mex" => "no content"));
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题