I need to verify if the content coming into my Azure http function is not empty and is of type JSON.
So I am doing this within my Azure function:
if (req.Body.Length == 0)
{
var nullresponse = req.CreateResponse(HttpStatusCode.BadRequest);
return nullresponse;
I want to check if it's type JSON too - any idea on how to do that?
req
is type HttpRequestData as per normal on isolated functions.
I have reproduced in my environment and below are my expected results:
Code:
Output:
If Empty String :
If Invalid Json:
If Valid Json: