I have this get request in my controller in ASP.NET Core project
[HttpGet]
[Route("api/controller/getlastresult/{id}")]
public IActionResult GetLatestResultForController(string id)
{
Response.ContentType = "application/json";
var list = _dbAccessLayer.GetAllVoteResults();
var appropriateResults = list.Where(item => item.DeviceId.Equals(id) && item.Status == "Finished")
.OrderBy(item => item.TimeStarted);
if (appropriateResults.Any())
return Ok(Json(appropriateResults.Last().Result));
return BadRequest();
}
It works fine, but in the headers there is Content-Type: application/json; charset=utf-8 as you can see here:
I need just regular application/json, without charset utf-8, so I guess it will be ASCII charset. Reason being that I use this request with microcontroller which does not like utf-8 encoding.
How do I set chaset in the response of my Get request? Thanks