Browse Source

refactored using added language feature (#836)

* refactored using added language feature

* refactored using added language feature
pull/848/head
Marvin Huber 6 years ago
committed by GitHub
parent
commit
21143d4e95
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      src/Microsoft.Tye.Hosting/Infrastructure/ProxyExtensions.cs

17
src/Microsoft.Tye.Hosting/Infrastructure/ProxyExtensions.cs

@ -34,13 +34,10 @@ namespace Microsoft.AspNetCore.Proxy
}
else
{
using (var requestMessage = context.CreateProxyHttpRequest(destinationUri))
{
using (var responseMessage = await context.SendProxyHttpRequest(invoker, requestMessage))
{
await context.CopyProxyHttpResponse(responseMessage);
}
}
using var requestMessage = context.CreateProxyHttpRequest(destinationUri);
using var responseMessage = await context.SendProxyHttpRequest(invoker, requestMessage);
await context.CopyProxyHttpResponse(responseMessage);
}
}
@ -204,10 +201,8 @@ namespace Microsoft.AspNetCore.Proxy
// SendAsync removes chunking from the response. This removes the header so it doesn't expect a chunked response.
response.Headers.Remove("transfer-encoding");
await using (var responseStream = await responseMessage.Content.ReadAsStreamAsync())
{
await responseStream.CopyToAsync(response.Body, StreamCopyBufferSize, context.RequestAborted);
}
await using var responseStream = await responseMessage.Content.ReadAsStreamAsync();
await responseStream.CopyToAsync(response.Body, StreamCopyBufferSize, context.RequestAborted);
}
}
}

Loading…
Cancel
Save