Fixing parse error when error response contains text with spaces