mirror of https://github.com/apache/nifi.git
parent
8a28395e9f
commit
c1ad913598
|
@ -82,6 +82,7 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
|||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.protocol.HttpCoreContext;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.http.util.VersionInfo;
|
||||
import org.apache.nifi.annotation.behavior.InputRequirement;
|
||||
import org.apache.nifi.annotation.behavior.InputRequirement.Requirement;
|
||||
import org.apache.nifi.annotation.behavior.SupportsBatching;
|
||||
|
@ -194,6 +195,7 @@ public class PostHTTP extends AbstractProcessor {
|
|||
.description("What to report as the User Agent when we connect to the remote server")
|
||||
.required(false)
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.defaultValue(VersionInfo.getUserAgent("Apache-HttpClient", "org.apache.http.client", HttpClientBuilder.class))
|
||||
.build();
|
||||
public static final PropertyDescriptor COMPRESSION_LEVEL = new PropertyDescriptor.Builder()
|
||||
.name("Compression Level")
|
||||
|
|
|
@ -434,4 +434,11 @@ public class TestPostHTTP {
|
|||
Assert.assertEquals(suppliedMimeType, lastPostHeaders.get(PostHTTP.CONTENT_TYPE_HEADER));
|
||||
Assert.assertEquals("4700",lastPostHeaders.get("Content-Length"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultUserAgent() throws Exception {
|
||||
setup(null);
|
||||
Assert.assertTrue(runner.getProcessContext().getProperty(PostHTTP.USER_AGENT).getValue().startsWith("Apache-HttpClient"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue