Skip to content

Commit 06b6d62

Browse files
authored
Merge pull request #173 from microsoft/andrueastman/fixParameters
Fixes missing parameter values on empty strings
2 parents a8aec2d + e6d2f2c commit 06b6d62

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.7.5] - 2024-01-11
11+
12+
### Changed
13+
14+
- Fixes missing query parameters when the parameter values are empty strings.(https://github.com/microsoft/kiota-abstractions-dotnet/issues/172)
15+
1016
## [1.7.4] - 2024-01-09
1117

1218
### Changed

Microsoft.Kiota.Abstractions.Tests/RequestInformationTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ public void DoesNotSetEmptyStringQueryParameters()
8787
requestInfo.AddQueryParameters(qParams);
8888

8989
// Assert
90-
Assert.False(requestInfo.QueryParameters.ContainsKey($"%24search"));
90+
Assert.True(requestInfo.QueryParameters.ContainsKey($"%24search"));
9191
Assert.False(requestInfo.QueryParameters.ContainsKey("search"));
92+
Assert.Equal("http://localhost/me?%24search=", requestInfo.URI.OriginalString);
9293
}
9394
[Fact]
9495
public void DoesNotSetEmptyCollectionQueryParameters()

src/Microsoft.Kiota.Abstractions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<PackageProjectUrl>https://aka.ms/kiota/docs</PackageProjectUrl>
1515
<EmbedUntrackedSources>true</EmbedUntrackedSources>
1616
<Deterministic>true</Deterministic>
17-
<VersionPrefix>1.7.4</VersionPrefix>
17+
<VersionPrefix>1.7.5</VersionPrefix>
1818
<VersionSuffix></VersionSuffix>
1919
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2020
<SignAssembly>false</SignAssembly>

src/RequestInformation.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ public void AddQueryParameters<T>(T source)
168168
)
169169
.Where(x => x.Value != null &&
170170
!QueryParameters.ContainsKey(x.Name!) &&
171-
!string.IsNullOrEmpty(x.Value.ToString()) && // no need to add an empty string value
172171
(x.Value is not ICollection collection || collection.Count > 0))) // no need to add empty collection
173172
{
174173
QueryParameters.AddOrReplace(property.Name!, property.Value!);

0 commit comments

Comments
 (0)