I'm having trouble with Refit using variables as path for a Get request
This is my super simple Get request
public interface IParceriaIntegracao
{
[Get("/{caminho}")]
Task<IntegracaoResponse> GetShow(string caminho);
}
This is my controller
[HttpGet]
[Route("integrar")]
public async Task<IActionResult> GetShow(string url)
{
try
{
Uri uri = new Uri(url);
string hostCompleto = $"{uri.Scheme}://{uri.Host}";
string caminho = $"{uri.AbsolutePath.Substring(1)}";
var host = RestService.For<IParceriaIntegracao>(hostCompleto);
var retorno = await host.GetShow(caminho);
return await Response(retorno.Message);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
The host goes well and not problem, teoretically the rest of the path should too. I tried with and without substring, and with and without the / in the Get annotation.
But it's returning error 404, as my path seems not to work properly.
Any idea of what it could be, or how i could solve?