diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f89b36..c3be742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,21 +1,31 @@ # Change Log + All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## Version [8.4.1] + +- Add version header to UpdateRole method to fix ContentfulException + ## Version [8.4.0] + - Added support for Taxonomy endpoints in the Management API - Added support for Taxonomy concepts in Entry and Asset metadata - Added new models for TaxonomyConcept and TaxonomyConceptScheme - Added methods for managing taxonomy concepts and concept schemes ## Version [1.2.0] + - Adds method `CreateEntryForLocaleAsync` to the management client. ## Version [1.1.1] + - Adds missing properties for the `SystemProperties` object. ## Version [1.1.0] + - Adds convenience methods to `ContentfulManagementClient` for retrieveing, creating and updating entries without having to use `Entry`. ## Version [1.0.0] -- Initial stable release on NetStandard 2.0 \ No newline at end of file + +- Initial stable release on NetStandard 2.0 diff --git a/Contentful.AspNetCore/Contentful.AspNetCore.csproj b/Contentful.AspNetCore/Contentful.AspNetCore.csproj index 888d89a..e2feaae 100644 --- a/Contentful.AspNetCore/Contentful.AspNetCore.csproj +++ b/Contentful.AspNetCore/Contentful.AspNetCore.csproj @@ -3,7 +3,7 @@ Official .NET SDK for the Contentful Content Delivery and Management API for ASP.NET core. contentful.aspnetcore en-US - 8.4.0 + 8.4.1 netstandard2.0 Contentful Contentful GmbH. @@ -13,10 +13,10 @@ https://github.com/contentful/contentful.net MIT git - 8.4.0 - 8.4.0.0 + 8.4.1 + 8.4.1.0 https://github.com/contentful/contentful.net - 8.4.0.0 + 8.4.1.0 bin\Release\netstandard1.5\Contentful.AspNetCore.xml @@ -25,7 +25,7 @@ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - + diff --git a/Contentful.Core.Tests/ContentfulManagementClientTests.cs b/Contentful.Core.Tests/ContentfulManagementClientTests.cs index a77d221..2f80803 100644 --- a/Contentful.Core.Tests/ContentfulManagementClientTests.cs +++ b/Contentful.Core.Tests/ContentfulManagementClientTests.cs @@ -2537,6 +2537,41 @@ public async Task UpdateRoleShouldCallCorrectUrlWithData(string id) Assert.Contains(@"""Settings"":[""read"",""manage""]", contentSet); } + [Theory] + [InlineData("test-role-123", 42)] + [InlineData("another-role-456", 99)] + public async Task UpdateRoleShouldSetVersionHeader(string id, int version) + { + //Arrange + _handler.Response = GetResponseFromFile(@"SampleRole.json"); + + var role = new Role() + { + SystemProperties = new SystemProperties() + { + Id = id, + Version = version + }, + Name = "Test Role", + Description = "Test role description" + }; + + var versionHeader = ""; + _handler.VerifyRequest = (HttpRequestMessage request) => + { + if (request.Headers.TryGetValues("X-Contentful-Version", out var values)) + { + versionHeader = values.FirstOrDefault(); + } + }; + + //Act + var res = await _client.UpdateRole(role); + + //Assert + Assert.Equal(version.ToString(), versionHeader); + } + [Theory] [InlineData("09hfdh4-34")] [InlineData("643")] diff --git a/Contentful.Core/Contentful.Core.csproj b/Contentful.Core/Contentful.Core.csproj index 6842609..a1ac0c0 100644 --- a/Contentful.Core/Contentful.Core.csproj +++ b/Contentful.Core/Contentful.Core.csproj @@ -4,7 +4,7 @@ contentful.csharp contentful.net en-US - 8.4.0 + 8.4.1 netstandard2.0 Contentful Contentful GmbH. diff --git a/Contentful.Core/ContentfulManagementClient.cs b/Contentful.Core/ContentfulManagementClient.cs index 97dc8ea..80576e3 100644 --- a/Contentful.Core/ContentfulManagementClient.cs +++ b/Contentful.Core/ContentfulManagementClient.cs @@ -1440,11 +1440,12 @@ public async Task UpdateRole(Role role, string spaceId = null, Cancellatio } var id = role.SystemProperties.Id; + var version = role.SystemProperties.Version; //Not allowed to post system properties role.SystemProperties = null; - using var res = await PutAsync($"{_baseUrl}{spaceId ?? _options.SpaceId}/roles/{id}", ConvertObjectToJsonStringContent(role), cancellationToken, null).ConfigureAwait(false); + using var res = await PutAsync($"{_baseUrl}{spaceId ?? _options.SpaceId}/roles/{id}", ConvertObjectToJsonStringContent(role), cancellationToken, version).ConfigureAwait(false); return await GetObjectFromResponse(res).ConfigureAwait(false); }