I'm trying to get Flurl
to work and I'm stuck on how gets work when passing in an ID.
[HttpGet("Get/{id}")]
public IActionResult Get(int id)
{
// Some something and return
}
The above expects
Get/1
So in Flurl:
var result = await _baseUrl
.AppendPathSegment("/Get")
.SetQueryParam("id", id)
.GetJsonAsync();
This produces this:
/Get?id=8
...which then fails with a 404.
How can I get Flurl to set a query param that is /id or get my get to accept both Get/id and Get?id=
I can do the following but it doesn't seem very elegant
var result = await _baseUrl
.AppendPathSegment(string.Format("/Get/{0}", id))
.GetJsonAsync();