Rest API and Rapid api plugin url encode the query parameters. The Providers returned are sorted by sortOrder in ascending order
This commit is contained in:
parent
4961f6ef23
commit
44d5dccbbb
|
|
@ -28,6 +28,8 @@ import reactor.core.publisher.Mono;
|
|||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -271,7 +273,8 @@ public class RapidApiPlugin extends BasePlugin {
|
|||
// If either the key or the value is empty, skip
|
||||
if (queryParam.getKey() != null && !queryParam.getKey().isEmpty() &&
|
||||
queryParam.getValue() != null && !queryParam.getValue().isEmpty()) {
|
||||
uriBuilder.queryParam(queryParam.getKey(), queryParam.getValue());
|
||||
uriBuilder.queryParam(queryParam.getKey(), URLEncoder.encode(queryParam.getValue(),
|
||||
StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ import java.io.IOException;
|
|||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
public class RestApiPlugin extends BasePlugin {
|
||||
|
|
@ -219,7 +221,8 @@ public class RestApiPlugin extends BasePlugin {
|
|||
if (queryParams != null) {
|
||||
for (Property queryParam : queryParams) {
|
||||
if (queryParam.getKey() != null && !queryParam.getKey().isEmpty()) {
|
||||
uriBuilder.queryParam(queryParam.getKey(), queryParam.getValue());
|
||||
uriBuilder.queryParam(queryParam.getKey(), URLEncoder.encode(queryParam.getValue(),
|
||||
StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class ProviderServiceImpl extends BaseService<ProviderRepository, Provide
|
|||
@Override
|
||||
public Flux<Provider> get(MultiValueMap<String, String> params) {
|
||||
Provider providerExample = new Provider();
|
||||
Sort sort = Sort.by(FieldName.NAME);
|
||||
Sort sort = Sort.by("sortOrder");
|
||||
|
||||
if (params.getFirst(FieldName.NAME) != null) {
|
||||
providerExample.setName(params.getFirst(FieldName.NAME));
|
||||
|
|
@ -58,6 +58,8 @@ public class ProviderServiceImpl extends BaseService<ProviderRepository, Provide
|
|||
}
|
||||
providerExample.setCategories(categories);
|
||||
|
||||
providerExample.setSortOrder(null);
|
||||
|
||||
return repository.findAll(Example.of(providerExample), sort);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user