g3rv4/Traducir

Fix console error: error de análisis XML: no se encontraron elementos

Closed this issue · 2 comments

Sorry I don't have exactly the translated text.

This is an easy fix. Blank results or empty results returned on net.core controllers give this error. To fix this, we should change the blank results to OkObjectResult(null);

This is what you see on the navigator console:

captura

g3rv4 commented

Here's the error in English:

message

Now, what's interesting is that the server ISN'T returning a content type that's XML

headers

According to this answer on Stack Overflow, it's a bug with Firefox. I totally agree... since nothing is telling Firefox to parse the response as an XML.

I wouldn't use OkObjectResult... I would return an empty response that ends up returning the status code 204 (No Content). I would expect Firefox to avoid parsing it as an XML then?

This answer in SO has the rigth option.

We should return NoContent() if we need a 204 status code.