Java 15035 (#13421)
* [JAVA-15035] Created module httpclient4 and moved related code * [JAVA-15035] Upgraded httpclient-simple to spring-boot-e * [JAVA-15035] Moved modules to to right profiles * [JAVA-15026] Upgraded headers code to apache 5.2 + moved code related to 4.5 to httpclient4 module * [JAVA-14911] Final clean up for http-client module --------- Co-authored-by: panagiotiskakos <panagiotis.kakos@libra-is.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package com.baeldung.httpclient;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.apache.http.HttpHeaders;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpUriRequest;
|
||||
import org.apache.http.client.methods.RequestBuilder;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class HttpClientHeaderV4LiveTest {
|
||||
|
||||
private static final String SAMPLE_URL = "http://www.github.com";
|
||||
|
||||
@Test
|
||||
void givenRequestBuildWithBuilder_whenRequestHasCustomContentType_thenCorrect() throws IOException {
|
||||
HttpClient client = HttpClients.custom().build();
|
||||
HttpUriRequest request = RequestBuilder.get()
|
||||
.setUri(SAMPLE_URL)
|
||||
.setHeader(HttpHeaders.CONTENT_TYPE, "application/json")
|
||||
.build();
|
||||
client.execute(request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user