Skip to content

Commit

Permalink
chore: stream iis fallback videos
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpop-zengenti committed Oct 7, 2024
1 parent f9b540e commit 60c667f
Showing 1 changed file with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,8 @@ public async Task<EndpointResponse> Invoke(

_logger.LogDebug("Making request to {Uri}", routeInfo.Uri);

var isStreamingRequestMessage = routeInfo.BlockVersionInfo != null &&
(httpMethod == HttpMethod.Post ||
httpMethod == HttpMethod.Put ||
httpMethod == HttpMethod.Patch);
var isStreamingRequestMessage = IsStreamingRequestMessage(httpMethod, routeInfo);

using var targetRequestMessage =
await CreateRequestMessage(httpMethod, content, headers, routeInfo, isStreamingRequestMessage);

Expand Down Expand Up @@ -265,6 +263,24 @@ public async Task<EndpointResponse> Invoke(
}
}

private bool IsStreamingRequestMessage(HttpMethod httpMethod, RouteInfo routeInfo)
{
if (routeInfo.BlockVersionInfo != null &&
(httpMethod == HttpMethod.Post ||
httpMethod == HttpMethod.Put ||
httpMethod == HttpMethod.Patch))
{
return true;
}

if (routeInfo.IsIisFallback && routeInfo.Uri.AbsolutePath.EndsWithCaseInsensitive(".mp4"))
{
return true;
}

return false;
}

private async Task<EndpointResponse> GetContent(
RouteInfo routeInfo,
HttpResponseMessage responseMessage,
Expand Down

0 comments on commit 60c667f

Please sign in to comment.