Skip to content

Commit

Permalink
fix: set request parameter to null when there is no variant
Browse files Browse the repository at this point in the history
  • Loading branch information
brunopacheco1 committed Nov 29, 2024
1 parent 81f1a1c commit 1c0c056
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import static java.util.Optional.ofNullable;
import static java.util.stream.Collectors.toMap;
import static org.apache.commons.lang3.ObjectUtils.isEmpty;
import static org.apache.commons.lang3.StringUtils.isNotBlank;

@ApplicationScoped
Expand All @@ -47,7 +48,8 @@ public Map<String, Integer> collect(DatasetSearchQuery query, String accessToken

var beaconQuery = BeaconIndividualsRequestMapper.from(query);

if (beaconAuthorization == null || beaconQuery.getQuery().getFilters().isEmpty()) {
if (beaconAuthorization == null || (isEmpty(beaconQuery.getQuery().getFilters()) &&
isEmpty(beaconQuery.getQuery().getRequestParameters()))) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public BeaconIndividualsRequest from(
.testMode(false)
.pagination(new BeaconIndividualsRequestQueryPagination())
.filters(beaconFilters)
.requestParameters(requestParameters)
.requestParameters(requestParameters.isEmpty() ? null : requestParameters)
.build())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void shouldAcceptNullQuery() {
.skip(0)
.build())
.filters(List.of())
.requestParameters(List.of())
.requestParameters(null)
.build())
.build());
}
Expand All @@ -71,7 +71,7 @@ void shouldAcceptEmptyQuery() {
.skip(0)
.build())
.filters(List.of())
.requestParameters(List.of())
.requestParameters(null)
.build())
.build());
}
Expand All @@ -97,7 +97,7 @@ void shouldAcceptEmptyFacets() {
.skip(0)
.build())
.filters(List.of())
.requestParameters(List.of())
.requestParameters(null)
.build())
.build());
}
Expand Down

0 comments on commit 1c0c056

Please sign in to comment.