@eviltrout / @blake this is actually a bigger API problem:
-
Are we strictly a JSON API, meaning do we expect every single endpoint to always return
render json: success_json
vsrender nothing: true
? -
If not, should we always be strict about returning json if the request is made to a
.json
resource ? (which means we need a fancy helper for render success)
As to the OP, I think that is legit that a PUT
to /suspend.json
should return a JSON payload. But… just cause you send JSON encoded body does not imply that the server must return JSON.
There is an argument for returning 200 with blank body, you are sending an infinitesimally smaller amount of data and a tiny bit less work on the JS side.
I am leaning towards just going with (1) and making every single PUT
and POST
JSON by default, and all XHRs JSON by default.