Given controller code:
[ApiController]
[Route("[controller]")]
public class TestController : ControllerBase
{
public string Get([FromQuery]TestInput? testInput)
{
return "OK";
}
}
public class TestInput
{
public string Value { get; set; }
}
How do I make /test
route working?
Note: I can get it working by making string properties on my model nullable, but that’s not what I want as it’s a mess. I can possibly get some luck with QueryStringValueProvider
as suggested in this post, but that seems like overkill given the caliber of the problem. I’d like to get as codeless as possible solution for this rather a simple problem.