我的RESTAPI返回JSON.
I'm currently returning text/plain as the MIME type, but it feels funny.
Should I be returning application/x-javascript
or some other type?
The second question is with regard to the HTTP status code for error conditions. If my REST API is returning an error state, I am returning as JSON
{ result: "fail", errorcode: 1024, errormesg: "That sucked. Try again!" }
HTTP状态代码是否应该保持为200 OK
?