I am using HttpClient to post some data to a NodeJs based server.
Class Employee
{
public string Name { get; set; }
}
The functional code:
Employee e = new Employee();
e.Name = "TestUser";
var client = new HttpClient();
var task = client.PostAsJsonAsync(urlTemplate, e);
var result = task.Result.Content.ReadAsStringAsync().Result;
The node application expects a property by name FirstName (instead of Name)
In WCF, we can change the name of DataMember by placing an attribute on top of its definition:
[DataMember(Name = "FirstName")]
public string Name { get; set; }
Do we have similar option when sending data using HttpClient?