Skip to content

Commit

Permalink
Fix IHasVersion in AsyncServiceClient
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Sep 6, 2017
1 parent 2545c56 commit b1d9805
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/ServiceStack.Client/AsyncServiceClient.cs
Expand Up @@ -129,6 +129,7 @@ public void SetCredentials(string userName, string password)
public bool ShareCookiesWithBrowser { get; set; }

public int Version { get; set; }

public string SessionId { get; set; }

internal Action CancelAsyncFn;
Expand Down
12 changes: 11 additions & 1 deletion src/ServiceStack.Client/ServiceClientBase.cs
Expand Up @@ -201,7 +201,17 @@ public string BearerToken

public string AsyncOneWayBaseUri { get; set; }

public int Version { get; set; }
private int version;
public int Version
{
get => version;
set
{
this.version = value;
this.asyncClient.Version = value;
}
}

public string SessionId { get; set; }

public string UserAgent
Expand Down
14 changes: 14 additions & 0 deletions tests/ServiceStack.WebHost.Endpoints.Tests/RouteTests.cs
Expand Up @@ -191,6 +191,13 @@ public async Task Does_send_version_using_JsonServiceClient()

response = await client.SendAsync(new RequestWithVersion { Version = 1 });
Assert.That(response.Version, Is.EqualTo(1));

client.Version = 1;
response = client.Send(new RequestWithVersion());
Assert.That(response.Version, Is.EqualTo(1));

response = await client.SendAsync(new RequestWithVersion());
Assert.That(response.Version, Is.EqualTo(1));
}

[Test]
Expand All @@ -202,6 +209,13 @@ public async Task Does_send_version_using_JsonHttpClient()

response = await client.SendAsync(new RequestWithVersion { Version = 1 });
Assert.That(response.Version, Is.EqualTo(1));

client.Version = 1;
response = client.Send(new RequestWithVersion());
Assert.That(response.Version, Is.EqualTo(1));

response = await client.SendAsync(new RequestWithVersion());
Assert.That(response.Version, Is.EqualTo(1));
}
}

Expand Down

0 comments on commit b1d9805

Please sign in to comment.