I have created an Azure logic app that exposes a REST endpoint.
The following JSON body works fine when I call it through postman.
{
"to": "[email protected]",
"subject": "Hello there",
"message": "Hello there!!!!!"
}
I'm able to see the incoming request formed nicely
{
"headers": {
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Accept": "*/*",
"Accept-Encoding": "gzip,deflate",
"Host": "maskedout.northcentralus.logic.azure.com:443",
"User-Agent": "PostmanRuntime/6.4.1",
"Content-Length": "99",
"Content-Type": "application/json"
},
"body": {
"to": "[email protected]",
"subject": "Hello there",
"message": "Hello there!!!!!"
}
}
However, when I try to make the same call using C# PostAsJsonAsync with this code:
var email = new Email
{
to = "[email protected]",
subject = "from webapp",
message = "hello world"
};
var client = new HttpClient();
var uri = "maskedout";
var response = await client.PostAsJsonAsync<Email>(uri, email);
I'm able to call my REST endpoint successfully, but it does not contain the body
This is the incoming request I see:
{
"headers": {
"Connection": "Keep-Alive",
"Transfer-Encoding": "chunked",
"Host": "maskedout.northcentralus.logic.azure.com",
"x-ms-request-root-id": "9e5513c2-43961642a3688718",
"x-ms-request-id": "|9e5513c2-43961642a3688718.1.",
"Request-Id": "|9e5513c2-43961642a3688718.1.1.",
"Content-Type": "application/json; charset=utf-8",
"Content-Length": "0"
}
}
What am I missing here? What's different in my C# code compared to postman?