Format code

This commit is contained in:
Zoe Roux 2024-01-29 03:13:39 +01:00
parent 68c28ed358
commit f65e4bc417

View File

@ -34,11 +34,18 @@ namespace Kyoo.Core.Api
[ApiController] [ApiController]
public class ProxyApi : Controller public class ProxyApi : Controller
{ {
private readonly HttpProxyOptions _proxyOptions = HttpProxyOptionsBuilder.Instance.WithHandleFailure(async (context, exception) => private readonly HttpProxyOptions _proxyOptions = HttpProxyOptionsBuilder
{ .Instance
context.Response.StatusCode = StatusCodes.Status503ServiceUnavailable; .WithHandleFailure(
await context.Response.WriteAsJsonAsync(new RequestError("Service unavailable")); async (context, exception) =>
}).Build(); {
context.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
await context
.Response
.WriteAsJsonAsync(new RequestError("Service unavailable"));
}
)
.Build();
/// <summary> /// <summary>
/// Transcoder proxy /// Transcoder proxy
@ -53,7 +60,10 @@ namespace Kyoo.Core.Api
public Task Proxy(string rest, [FromQuery] Dictionary<string, string> query) public Task Proxy(string rest, [FromQuery] Dictionary<string, string> query)
{ {
// TODO: Use an env var to configure transcoder:7666. // TODO: Use an env var to configure transcoder:7666.
return this.HttpProxyAsync($"http://transcoder:7666/{rest}" + query.ToQueryString(), _proxyOptions); return this.HttpProxyAsync(
$"http://transcoder:7666/{rest}" + query.ToQueryString(),
_proxyOptions
);
} }
} }
} }