Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
prepare 5.6.5 release (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
eli-darkly authored May 31, 2019
1 parent 11bc48a commit 7697fbf
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the LaunchDarkly .NET Server-Side SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).

## [5.6.5] - 2019-05-30
### Fixed:
- If streaming is disabled, polling requests could stop working if the client ever received an HTTP error from LaunchDarkly. This bug was introduced in the 5.6.3 release.

## [5.6.4] - 2019-05-10
### Changed:
- The NuGet package name and assembly name have changed: they are now `LaunchDarkly.ServerSdk` instead of `LaunchDarkly.Client`. There are no other changes in this release; the namespace used in .NET code is still `LaunchDarkly.Client`. Substituting `LaunchDarkly.Client` version 5.6.3 with `LaunchDarkly.ServerSdk` version 5.6.4 will not affect functionality.
Expand Down
15 changes: 11 additions & 4 deletions src/LaunchDarkly.ServerSdk/FeatureRequestor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,22 @@ private async Task<T> GetAsync<T>(Uri path) where T : class
Log.Debug("Get all flags returned 304: not modified");
return null;
}
lock (_etags)
{
_etags[path] = response.Headers.ETag;
}
//We ensure the status code after checking for 304, because 304 isn't considered success
if (!response.IsSuccessStatusCode)
{
throw new UnsuccessfulResponseException((int)response.StatusCode);
}
lock (_etags)
{
if (response.Headers.ETag != null)
{
_etags[path] = response.Headers.ETag;
}
else
{
_etags.Remove(path);
}
}
var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
return string.IsNullOrEmpty(content) ? null : (T)JsonConvert.DeserializeObject<T>(content);
}
Expand Down
2 changes: 1 addition & 1 deletion src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>5.6.4</Version>
<Version>5.6.5</Version>
<TargetFrameworks>netstandard1.4;netstandard1.6;netstandard2.0;net45</TargetFrameworks>
<PackageLicenseUrl>https://raw.githubusercontent.com/launchdarkly/dotnet-server-sdk/master/LICENSE</PackageLicenseUrl>
<DebugType>portable</DebugType>
Expand Down
28 changes: 28 additions & 0 deletions test/LaunchDarkly.ServerSdk.Tests/FeatureRequestorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,34 @@ public async Task ETagsDoNotConflict()
Assert.Equal(new List<string> { etag1 }, reqs[4].RequestMessage.Headers["If-None-Match"]);
}

[Fact]
public async Task ResponseWithoutEtagClearsPriorEtag()
{
var etag = @"""abc123""";

_server.Given(Request.Create().UsingGet())
.AtPriority(2)
.RespondWith(Response.Create().WithStatusCode(200).WithHeader("Etag", etag).WithBody(AllDataJson));
_server.Given(Request.Create().UsingGet().WithHeader("If-None-Match", etag))
.AtPriority(1)
.RespondWith(Response.Create().WithStatusCode(200).WithBody(AllDataJson)); // respond with no etag

var fetch1 = await _requestor.GetAllDataAsync();
var fetch2 = await _requestor.GetAllDataAsync();

_server.Given(Request.Create().UsingGet())
.AtPriority(1)
.RespondWith(Response.Create().WithStatusCode(200).WithHeader("Etag", etag).WithBody(AllDataJson));

var fetch3 = await _requestor.GetAllDataAsync();

var reqs = new List<LogEntry>(_server.LogEntries);
Assert.Equal(3, reqs.Count);
Assert.False(reqs[0].RequestMessage.Headers.ContainsKey("If-None-Match"));
Assert.Equal(new List<string> { etag }, reqs[1].RequestMessage.Headers["If-None-Match"]);
Assert.False(reqs[2].RequestMessage.Headers.ContainsKey("If-None-Match"));
}

private RequestMessage GetLastRequest()
{
foreach (LogEntry le in _server.LogEntries)
Expand Down

0 comments on commit 7697fbf

Please sign in to comment.