Skip to content

Commit

Permalink
Merge fix
Browse files Browse the repository at this point in the history
  • Loading branch information
FeroxRev committed Aug 2, 2016
2 parents 92de536 + a7e28cb commit e71b005
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions PokemonGo.RocketAPI/Extensions/HttpClientExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public enum ApiOperation

public interface IApiFailureStrategy
{
Task<ApiOperation> HandleApiFailure();
void HandleApiSuccess();
Task<ApiOperation> HandleApiFailure(RequestEnvelope request, ResponseEnvelope response);
void HandleApiSuccess(RequestEnvelope request, ResponseEnvelope response);
}

public static class HttpClientExtensions
Expand All @@ -41,14 +41,14 @@ public static async Task<IMessage[]> PostProtoPayload<TRequest>(this System.Net.
ResponseEnvelope response;
while ((response = await PostProto<TRequest>(client, url, requestEnvelope)).Returns.Count != responseTypes.Length)
{
var operation = await strategy.HandleApiFailure();
var operation = await strategy.HandleApiFailure(requestEnvelope, response);
if (operation == ApiOperation.Abort)
{
throw new InvalidResponseException($"Expected {responseTypes.Length} responses, but got {response.Returns.Count} responses");
}
}

strategy.HandleApiSuccess();
strategy.HandleApiSuccess(requestEnvelope, response);

for (var i = 0; i < responseTypes.Length; i++)
{
Expand All @@ -67,7 +67,7 @@ public static async Task<TResponsePayload> PostProtoPayload<TRequest, TResponseP

while (response.Returns.Count == 0)
{
var operation = await strategy.HandleApiFailure();
var operation = await strategy.HandleApiFailure(requestEnvelope, response);
if (operation == ApiOperation.Abort)
{
break;
Expand All @@ -79,7 +79,7 @@ public static async Task<TResponsePayload> PostProtoPayload<TRequest, TResponseP
if (response.Returns.Count == 0)
throw new InvalidResponseException();

strategy.HandleApiSuccess();
strategy.HandleApiSuccess(requestEnvelope, response);

//Decode payload
//todo: multi-payload support
Expand Down

0 comments on commit e71b005

Please sign in to comment.