fix: use Endpoints for filtered recipe urls
This commit is contained in:
parent
19fdf7f361
commit
c6f6a6f73d
2 changed files with 6 additions and 6 deletions
|
|
@ -80,6 +80,10 @@ public class Endpoints {
|
|||
return this.http(url).GET();
|
||||
}
|
||||
|
||||
public HttpRequest.Builder getRecipesWith(String params) {
|
||||
return this.http(this.createApiUrl("/recipes?" + params)).GET();
|
||||
}
|
||||
|
||||
public HttpRequest.Builder createIngredient(HttpRequest.BodyPublisher body) {
|
||||
String url = this.createApiUrl("/ingredients");
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import org.glassfish.jersey.client.ClientConfig;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.ConnectException;
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
|
|
@ -68,11 +67,8 @@ public class ServerUtils {
|
|||
*/
|
||||
public List<Recipe> getRecipesFiltered(String filter, List<String> locales) throws IOException, InterruptedException {
|
||||
//TODO add limit integration
|
||||
String uri = configService.getConfig().getServerUrl() + "/recipes?search=" + filter + "&locales=" + String.join(",", locales);
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(URI.create(uri))
|
||||
.GET()
|
||||
.build();
|
||||
HttpRequest request = this.endpoints
|
||||
.getRecipesWith("search=" + filter + "&locales=" + String.join(",", locales)).build();
|
||||
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
|
||||
if(response.statusCode() != statusOK){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue