Update resource.js

For DELETE and PUT request, the response is empty, the JSON.parse doen't work on nothing.
Do you prefer do the test before the call of parse or inside?