Class HttpClientConfiguration.Builder
java.lang.Object
com.github.mjeanroy.junit.servers.client.HttpClientConfiguration.Builder
- Enclosing class:
- HttpClientConfiguration
Builder for
HttpClientConfiguration
class.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddDefaultCookie
(Cookie cookie) Add new default cookie.addDefaultCookie
(String name, String value) Add new default cookie.addDefaultHeader
(HttpHeader header) Add new default header: if a header with the same name as already been added, it will be overwritten with this new header.addDefaultHeader
(String name, String value) Add new default header: if a header with the same name as already been added, it will be overwritten with this new header.build()
Create new client configuration.Disable follow redirection handling.Enable follow redirection handling.
-
Constructor Details
-
Builder
public Builder()Create builder with default values.- See Also:
-
HttpClientConfiguration.DEFAULT_FOLLOW_REDIRECT
-
-
Method Details
-
addDefaultHeader
Add new default header: if a header with the same name as already been added, it will be overwritten with this new header.- Parameters:
header
- The header.- Returns:
- The builder (for chaining).
- Throws:
NullPointerException
- Ifheader
isnull
.
-
addDefaultHeader
Add new default header: if a header with the same name as already been added, it will be overwritten with this new header.- Parameters:
name
- Header name.value
- Header value.- Returns:
- The builder (for chaining).
- Throws:
NullPointerException
- Ifname
orvalue
arenull
.IllegalArgumentException
- Ifname
is empty or blank.- See Also:
-
addDefaultCookie
Add new default cookie.- Parameters:
cookie
- The cookie to add.- Returns:
- The builder (for chaining).
- Throws:
NullPointerException
- Ifcookie
isnull
.
-
addDefaultCookie
Add new default cookie.- Parameters:
name
- Cookie name.value
- Cookie value.- Returns:
- The builder (for chaining).
- Throws:
NullPointerException
- Ifname
orvalue
arenull
.- See Also:
-
enableFollowRedirect
Enable follow redirection handling.- Returns:
- The builder (for chaining).
-
disableFollowRedirect
Disable follow redirection handling.- Returns:
- The builder (for chaining).
-
build
Create new client configuration.- Returns:
- The HTTP client configuration.
-