Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHodgson committed Nov 14, 2024
1 parent 21a5d15 commit 34742b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions OpenAI-DotNet-Proxy/Proxy/EndpointRouteBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async Task HandleRequest(HttpContext httpContext, string endpoint)
request.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse(httpContext.Request.ContentType);
}

var proxyResponse = await openAIClient.Client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false);
var proxyResponse = await openAIClient.Client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, httpContext.RequestAborted).ConfigureAwait(false);
httpContext.Response.StatusCode = (int)proxyResponse.StatusCode;

foreach (var (key, value) in proxyResponse.Headers)
Expand All @@ -109,7 +109,7 @@ async Task HandleRequest(HttpContext httpContext, string endpoint)
}
else
{
await proxyResponse.Content.CopyToAsync(httpContext.Response.Body).ConfigureAwait(false);
await proxyResponse.Content.CopyToAsync(httpContext.Response.Body, httpContext.RequestAborted).ConfigureAwait(false);
}
}
catch (AuthenticationException authenticationException)
Expand Down

0 comments on commit 34742b5

Please sign in to comment.