Moved article code to new module (#12423)
This commit is contained in:
@@ -12,5 +12,4 @@ This module contains articles about Java 11 core features
|
||||
- [Java HTTPS Client Certificate Authentication](https://www.baeldung.com/java-https-client-certificate-authentication)
|
||||
- [Call Methods at Runtime Using Java Reflection](https://www.baeldung.com/java-method-reflection)
|
||||
- [Java HttpClient Basic Authentication](https://www.baeldung.com/java-httpclient-basic-auth)
|
||||
- [Java HttpClient With SSL](https://www.baeldung.com/java-httpclient-ssl)
|
||||
- [Adding Parameters to Java HttpClient Requests](https://www.baeldung.com/java-httpclient-request-parameters)
|
||||
- [Java HttpClient With SSL](https://www.baeldung.com/java-httpclient-ssl)
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.baeldung.httpclient.parameters;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class HttpClientParametersLiveTest {
|
||||
|
||||
private static HttpClient client;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUp() {
|
||||
client = HttpClient.newHttpClient();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenQueryParams_whenGetRequest_thenResponseOk() throws IOException, InterruptedException {
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.version(HttpClient.Version.HTTP_2)
|
||||
.uri(URI.create("https://postman-echo.com/get?param1=value1¶m2=value2"))
|
||||
.GET()
|
||||
.build();
|
||||
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
|
||||
assertEquals(response.statusCode(), 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenQueryParams_whenGetRequestWithDefaultConfiguration_thenResponseOk() throws IOException, InterruptedException {
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(URI.create("https://postman-echo.com/get?param1=value1¶m2=value2"))
|
||||
.build();
|
||||
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
|
||||
assertEquals(response.statusCode(), 200);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user