Direct an Azure Function App to accept only Application/json
Hi, I'm using an Azure Function and testing it through Postman.
My requirement is when we pass Content-Type other than "application/json", I'm expecting my Azure Function to return saying "Invalid Content - Type".
The above need I'm able to achieve with the Code changes as below.
if(HTTPRequest.Headers["Content-Type"] != "application/json") -- then returing "Invalid Content - Type"
But is it possible and is there any way we can achieve the same using Configuration Setting (i.e host.json) in Azure Function App ?
Also, I have tried adding the below under customHeaders in host.json file. But it didn't work.
"Accept": "application/json"
"Access-Control-Expose-Headers": "application/json"
Thanks in Advance...