Skip to content

Commit

Permalink
Removing code which disposes request and response content as it is no…
Browse files Browse the repository at this point in the history
…t required
  • Loading branch information
neilcampbell committed Sep 12, 2014
1 parent 13245ba commit b6f568b
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions PactNet/Mocks/MockHttpService/HttpClientRequestSender.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Net.Http;
using System;
using System.Net.Http;
using System.Threading;
using PactNet.Mocks.MockHttpService.Mappers;
using PactNet.Mocks.MockHttpService.Models;
Expand Down Expand Up @@ -39,27 +40,18 @@ public ProviderServiceResponse Send(ProviderServiceRequest request)
var httpResponse = _httpClient.SendAsync(httpRequest, CancellationToken.None).Result;
var response = _providerServiceResponseMapper.Convert(httpResponse);

if (httpRequest != null)
{
if (httpRequest.Content != null)
{
httpRequest.Content.Dispose();
}
Dispose(httpRequest);
Dispose(httpResponse);

httpRequest.Dispose();
}
return response;
}

if (httpResponse != null)
private void Dispose<T>(T disposable) where T : class, IDisposable
{
if (disposable != null)
{
if (httpResponse.Content != null)
{
httpResponse.Content.Dispose();
}

httpResponse.Dispose();
disposable.Dispose();
}

return response;
}
}
}

0 comments on commit b6f568b

Please sign in to comment.