I am trying to pass a parameter of an object through a post request in a web api microsoft application, but the parameter passed is always null.
This is my Controller for post method, under debugging the program reached the method but dataUrlIN.url string is always empty
[HttpPost]
public void Post(DataUrl dataUrlIN)
{
string a = dataUrlIN.url;
a += a + "/test";
}
This is the object of DataUrl
public class DataUrl
{
public string url { get; set; }
}
This is the the post request
POST /api/values HTTP/1.1
Host: localhost:50673
Content-Type: application/json
User-Agent: PostmanRuntime/7.11.0
Accept: */*
Cache-Control: no-cache
Postman-Token: a12b47ba-8595-4297-b3e1-380052fb2a46,b4b4d699-206b-47ff-9fa3-71d06d4334d2
Host: localhost:50673
accept-encoding: gzip, deflate
content-length: 28
Connection: keep-alive
cache-control: no-cache
{
"url" : "helloWorld"
}
After sending the post request the breakpoint in the method public void Post(Data Url dataUrlIN) is triggered but the url string is empty "HelloWorld" string never appears