Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop execution on assigned AddQueryParameters value #182

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

### Changed

## [1.7.1] - 2024-08-29

- Minor performance improvements in the `AddQueryParameters` implementation.

### Added

## [1.7.0] - 2024-07-09
## [1.7.0] - 2024-08-29

- Added accessors for headers and status to `ApiErrorable` [#177](https://github.com/microsoft/kiota-abstractions-go/issues/177)

Expand Down
5 changes: 5 additions & 0 deletions request_information.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,14 +498,17 @@ func (request *RequestInformation) AddQueryParameters(source any) {
str, ok := value.(*string)
if ok && str != nil {
request.QueryParameters[fieldName] = *str
continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will introduce a regression skipping normalization below.

updating to

		if str, ok := value.(*string); ok && str != nil {

and else if
and removing the continues
should achieve the desired performance improvement

}
bl, ok := value.(*bool)
if ok && bl != nil {
request.QueryParameters[fieldName] = strconv.FormatBool(*bl)
continue
}
it, ok := value.(*int32)
if ok && it != nil {
request.QueryParameters[fieldName] = strconv.FormatInt(int64(*it), 10)
continue
}
strArr, ok := value.([]string)
if ok && len(strArr) > 0 {
Expand All @@ -517,9 +520,11 @@ func (request *RequestInformation) AddQueryParameters(source any) {
tmp[i] = v
}
request.QueryParametersAny[fieldName] = tmp
continue
}
if arr, ok := value.([]any); ok && len(arr) > 0 {
request.QueryParametersAny[fieldName] = arr
continue
}
normalizedValue := request.normalizeParameters(valueOfValue, value, true)
if normalizedValue != nil {
Expand Down
Loading