Skip to content

Commit

Permalink
Merge pull request #136 from XdpCs/fix-query-string
Browse files Browse the repository at this point in the history
fix(request_information): fix empty string
  • Loading branch information
baywet authored Jan 16, 2024
2 parents f119d9a + aa16daa commit 8266e41
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

## [1.5.4] - 2024-01-16

### Changed

- Fix bug where empty string query parameters are added to the request. [#133](https://github.com/microsoft/kiota-abstractions-go/issues/133)

## [1.5.3] - 2023-11-24

### Added
Expand Down
2 changes: 1 addition & 1 deletion request_information.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ func (request *RequestInformation) AddQueryParameters(source any) {
continue
}
str, ok := value.(*string)
if ok && str != nil && *str != "" {
if ok && str != nil {
request.QueryParameters[fieldName] = *str
}
bl, ok := value.(*bool)
Expand Down
2 changes: 1 addition & 1 deletion request_information_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func TestItDoesNotSetEmptySearchQueryParameters(t *testing.T) {
})
resultUri, err := requestInformation.GetUri()
assert.Nil(t, err)
assert.Equal(t, "http://localhost/me", resultUri.String())
assert.Equal(t, "http://localhost/me?%24search=", resultUri.String())
}

func TestItSetsPathParametersOfDateTimeOffsetType(t *testing.T) {
Expand Down

0 comments on commit 8266e41

Please sign in to comment.