Skip to content

Commit

Permalink
Merge pull request #103 from ichbinsteffen/bugfix/ISSUE-81_CaseInsens…
Browse files Browse the repository at this point in the history
…itiveQueryParameters

Issue #81: Fix case insensitivity bug
  • Loading branch information
baywet authored Jul 4, 2023
2 parents a1f71a8 + 5e50a0c commit 8e0189e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
## [1.2.1] - 2023-07-03

### Fixed

- Fixed a bug that caused the uri parameters not to be applied when the Uri template had a different casing than the parameter name that was used to set it.

## [1.2.0] - 2023-06-28

Expand Down
16 changes: 16 additions & 0 deletions Microsoft.Kiota.Abstractions.Tests/RequestInformationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,22 @@ public void SetsScalarCollectionContent() {
serializationWriterMock.Verify(x => x.WriteStringValue(It.IsAny<string>(), It.IsAny<string>()), Times.Never);
serializationWriterMock.Verify(x => x.WriteCollectionOfPrimitiveValues(It.IsAny<string>(), It.IsAny<IEnumerable<string>>()), Times.Once);
}
[Fact]
public void GetUriResolvesParametersCaseInsensitive()
{
// Arrange
var testRequest = new RequestInformation()
{
HttpMethod = Method.GET,
UrlTemplate = "http://localhost/{URITemplate}/ParameterMapping?IsCaseSensitive={IsCaseSensitive}"
};
// Act
testRequest.PathParameters.Add("UriTemplate", "UriTemplate");
testRequest.QueryParameters.Add("iscasesensitive", "false");

// Assert
Assert.Equal("http://localhost/UriTemplate/ParameterMapping?IsCaseSensitive=false", testRequest.URI.ToString());
}
}

/// <summary>The messages in a mailbox or folder. Read-only. Nullable.</summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Kiota.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageProjectUrl>https://aka.ms/kiota/docs</PackageProjectUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<Deterministic>true</Deterministic>
<VersionPrefix>1.2.0</VersionPrefix>
<VersionPrefix>1.2.1</VersionPrefix>
<VersionSuffix></VersionSuffix>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<SignAssembly>false</SignAssembly>
Expand Down
2 changes: 1 addition & 1 deletion src/RequestInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public Uri URI {
if(UrlTemplate?.IndexOf("{+baseurl}", StringComparison.OrdinalIgnoreCase) >= 0 && !PathParameters.ContainsKey("baseurl"))
throw new InvalidOperationException($"{nameof(PathParameters)} must contain a value for \"baseurl\" for the url to be built.");

var parsedUrlTemplate = new UriTemplate(UrlTemplate);
var parsedUrlTemplate = new UriTemplate(UrlTemplate, caseInsensitiveParameterNames: true);
foreach(var urlTemplateParameter in PathParameters)
{
parsedUrlTemplate.SetParameter(urlTemplateParameter.Key, GetSanitizedValue(urlTemplateParameter.Value));
Expand Down

0 comments on commit 8e0189e

Please sign in to comment.