mirror of
https://github.com/apache/nifi.git
synced 2025-02-15 14:35:38 +00:00
NIFI-14248 Added HEAD method to NiFi web client (#9702)
Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
parent
6f958fe068
commit
a0d3d48c97
@ -24,6 +24,8 @@ public enum StandardHttpRequestMethod implements HttpRequestMethod {
|
||||
|
||||
GET,
|
||||
|
||||
HEAD,
|
||||
|
||||
PATCH,
|
||||
|
||||
POST,
|
||||
|
@ -42,6 +42,13 @@ public interface WebClientService {
|
||||
*/
|
||||
HttpRequestUriSpec get();
|
||||
|
||||
/**
|
||||
* Create HTTP Request builder starting with HTTP HEAD
|
||||
*
|
||||
* @return HTTP Request URI Specification builder
|
||||
*/
|
||||
HttpRequestUriSpec head();
|
||||
|
||||
/**
|
||||
* Create HTTP Request builder starting with HTTP PATCH
|
||||
*
|
||||
|
@ -183,6 +183,16 @@ public class StandardWebClientService implements WebClientService, Closeable {
|
||||
return method(StandardHttpRequestMethod.GET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create HTTP Request builder starting with HTTP HEAD
|
||||
*
|
||||
* @return HTTP Request URI Specification builder
|
||||
*/
|
||||
@Override
|
||||
public HttpRequestUriSpec head() {
|
||||
return method(StandardHttpRequestMethod.HEAD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create HTTP Request builder starting with HTTP PATCH
|
||||
*
|
||||
|
@ -39,6 +39,7 @@ import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -249,6 +250,21 @@ public class StandardWebClientServiceTest {
|
||||
runRequestMethod(service.get(), StandardHttpRequestMethod.GET, HttpResponseStatus.SERVICE_UNAVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testHead() throws InterruptedException, IOException {
|
||||
runRequestMethod(service.head(), StandardHttpRequestMethod.HEAD, HttpResponseStatus.OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testHeadNoContent() throws InterruptedException, IOException {
|
||||
runRequestMethod(service.head(), StandardHttpRequestMethod.HEAD, HttpResponseStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testHeadNotFound() throws InterruptedException, IOException {
|
||||
runRequestMethod(service.head(), StandardHttpRequestMethod.HEAD, HttpResponseStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPatch() throws InterruptedException, IOException {
|
||||
runRequestMethodRequestBody(service.patch(), StandardHttpRequestMethod.PATCH, HttpResponseStatus.OK);
|
||||
|
Loading…
x
Reference in New Issue
Block a user