I’m trying to send data (two strings in this case) from the .jsx file to an endpoint C# method. However, I’m only able to hit the endpoint if I leave its signature without parameters. If I try ‘String[] args’ or any other signature I get an “Unsupported Media Type” error. I verified that the parameters are in the ‘el’ parameter but how do I get them to the C# method?
.jsx:
async function SendCookieData(el) {
const response = await fetch('cookie',
{
method: "PUT",
body: JSON.stringify(el)
});
const data = await response.json();
}
endpoint:
[HttpPut(Name = "cookiesubmit")]
public IEnumerable<Cookie> Put(String[] args)
{
...
}