When I access my azure (C # HttpTrigger) function from my browser, I get an XML response with an error message instead of a JSON response.
This is to be expected, since the answer contains, among other things, a JObject that can be serialized for JSON just fine, but not for XML, and the Accept header in the browser prefers to use XML over JSON.
I can use a workaround to get the right answer, running off with the Accept (inserting application/json;q=0.95) browser header , but I really want to disable XML serialization in Azure Function, since my function will not be XML compatible anyway.
Is there a way to remove or disable XML formatting in Azure Functions so that it βforgetsβ that it can be serialized in XML, and anyone application/xmlin the request header is ignored? And instead, JSON formatting takes precedence despite a request to give preference to XML?
source
share