Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No disposing of response in case of WebException #125

Merged
merged 1 commit into from Jun 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/NServiceBus.Gateway/Channels/Http/HttpChannelSender.cs
Expand Up @@ -29,11 +29,20 @@ public async Task Send(string remoteUrl, IDictionary<string, string> headers, St

HttpStatusCode statusCode;

//todo make the receiver send the md5 back so that we can double check that the transmission went ok
using (var response = (HttpWebResponse) await request.GetResponseAsync().ConfigureAwait(false))
try
{
statusCode = response.StatusCode;
//todo make the receiver send the md5 back so that we can double check that the transmission went ok
using (var response = (HttpWebResponse)await request.GetResponseAsync().ConfigureAwait(false))
{
statusCode = response.StatusCode;
}
}
catch (WebException ex)
{
ex.Response?.Dispose();
throw;
}


Logger.Debug("Got HTTP response with status code " + statusCode);

Expand Down