What MIME type if JSON is being returned by a REST API?

前端 未结 6 1625
终归单人心
终归单人心 2020-12-07 22:35

My REST API returns JSON.

I\'m currently returning text/plain as the MIME type, but it feels funny. Should I be returning application/x-javascript or s

6条回答
  •  遥遥无期
    2020-12-07 23:06

    No, you shouldn't return 200 in an error condition.

    It's ok to repeat the status code, or to include a more detailed error code in the response payload.

提交回复
热议问题