HttpClientConfig

Property Summary

TypeNameSummary

Sets whether client should follow redirects or you want to do it manually..

Force the use of http1, use this if there are problems connecting to a server that does use http/2 but uses old cipher suites or if there are other problems like http/2 not setting the content length and the server still wants it..

Disable hostname certificate validation..

Gets/Sets keep alive duration in seconds for a connection, default is -1 (no duration specified)..

Gets/Sets maximum number of input/output threads per client, default value is 2..

Gets/Sets which TLS protocol to use, default value is TLS..

Gets/Sets custom userAgent to use..

Properties Details

enableRedirects

Sets whether client should follow redirects or you want to do it manually. Default value is true.

Returns Boolean

Sample

var config = plugins.http.createNewHttpClientConfig();
config.enableRedirects = false;
var client = plugins.http.createNewHttpClient(config);

forceHttp1

Force the use of http1, use this if there are problems connecting to a server that does use http/2 but uses old cipher suites or if there are other problems like http/2 not setting the content length and the server still wants it.

Returns Boolean

Sample

var config = plugins.http.createNewHttpClientConfig();
config.forceHttp1 = true;
var client = plugins.http.createNewHttpClient(config);

hostValidation

Disable hostname certificate validation. This should be used only for testing purposes, because this is not secure!

Returns Boolean

Sample

var config = plugins.http.createNewHttpClientConfig();
config.hostValidation = false;
var client = plugins.http.createNewHttpClient(config);

keepAliveDuration

Gets/Sets keep alive duration in seconds for a connection, default is -1 (no duration specified).

Returns Number

Sample

var config = plugins.http.createNewHttpClientConfig();
config.keepAliveDuration = 5;
var client = plugins.http.createNewHttpClient(config);

maxIOThreadCount

Gets/Sets maximum number of input/output threads per client, default value is 2.

Returns Number

Sample

var config = plugins.http.createNewHttpClientConfig();
config.maxIOThreadCount = 5;
var client = plugins.http.createNewHttpClient(config);

protocol

Gets/Sets which TLS protocol to use, default value is TLS.

Returns String

Sample

var config = plugins.http.createNewHttpClientConfig();
config.protocol = "TLSv1.2";
var client = plugins.http.createNewHttpClient(config);

userAgent

Gets/Sets custom userAgent to use.

Returns String

Sample

var config = plugins.http.createNewHttpClientConfig();
config.userAgent = "Mozilla/5.0 Firefox/26.0";
var client = plugins.http.createNewHttpClient(config);

Last updated