Http post to mvc .NET application

Hi Everyone,
Earlier today i was facing the issue i m about to demonstrate. I m posting this small topic,in case someone else stumps in to the same problem in the future. I searched the forum if similar issues have been reported but since i couldn't find anything that could relate,i thought to start a new topic. Let me briefly explain my situation.I m trying to post my lora nodes data,back to my .NET Server.I have created a flow in which

1.at the very begging i m receiving my lora node data.
2.I then use a function node where i m preparing the data for posting by performing a simple mapping of properties between my lora node and what my server expects.
3.I post the data to the server.
Now after this step is where i was not finding resolution.
4.After my previous http post,i then read some json data from a file.
5.I then just feed the data to another post node in order to push them to my web server,only this time i was posting to a different url.

image

The problem that i was facing is that the posted data ,from my second call,were not being retrieved by the server. At first i thought that there could be something wrong with the code on the node-red and perhaps i was sending wrong data or in the wrong format. Although i definitively hadn't excluded that scenario, i thought that there might be something else going on. If i debug my web server,during the web call, i see that the http request body string content,contains only 3 characters. It happens that these characters were actually the start of my json data. It seems that for some reason the data were being cut off. To make my self more clear consider the following json:

[{"ack":false}]

No on my web server i m receiving only "[{a" and the rest string is missing. It took me some time to consider that the Content-Type might not be set properly but the reason it didn't occurred to me earlier is because i m already sending post data successfully on another flow that i have set up. So since i was already posting data i focused my attention on different causes. So to conclude this small post,i would like to say that explicitly setting the Content-Type was my solution.

msg.headers['Content-Type'] ='application/json; charset=utf-8';

Here is the flow description for reference:node-red-flow.txt (3.5 KB)