I have quite a few REST end-points that process a request and simply return 200. I noticed it is an error to map the result with json(). If I try not to do any sort of mapping whatsoever, I see a browser warning that it could not parse XML. As returning nothing is pretty common, I am curious how I should be handling the response.
Here is a basic code example:
await this.http.put("/api/some_url", data).toPromise();
Here is the warning that shows up in Firefox:
XML Parsing Error: no root element found Location: http://localhost/api/some_url Line Number 1, Column 1:
If I try to map with json(), it blows up entirely. If I do nothing or try to map to text(), I just get the warning.
In all cases, the response headers contain Content-Length: 0, so I am surprised Angular2/Firefox is trying to parse anything. I don't know if this warning is coming from Angular2 or Firefox. I have tried this in Chrome and IE and there is no warning. So I am wondering if it is specific to Firefox.