Fix handling of empty xhr responseText in response

Attempting to parse an empty string with `JSON.parse` throws an error.
This sets the body as null instead.