Class HttpRequest
- All Implemented Interfaces:
HttpMessage<HttpRequest,,Body> Message
- Author:
- jamesdbloom
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()booleancontainsHeader(String name) Returns true if a header with the specified name has been addedbooleancontainsHeader(String name, String value) Returns true if a header with the specified name and value has been addedstatic HttpRequestbooleanstatic HttpRequestgetBody()byte[]byte[]getFirstHeader(String name) getFirstPathParameter(String name) byte[]When a request arrived with a Content-Encoding (e.g. gzip) and MockServer decompressed it, this holds the original bytes exactly as received on the wire (still compressed).getPath()inthashCode()booleanhasPathParameter(String name, String value) booleanhasPathParameter(NottableString name, NottableString value) booleanhasQueryStringParameter(String name, String value) booleanhasQueryStringParameter(NottableString name, NottableString value) static HttpRequestisSecure()booleanbooleanstatic HttpRequeststatic HttpRequeststatic HttpRequeststatic HttpRequestremoveHeader(String name) removeHeader(NottableString name) replaceHeader(Header header) Adds one header to match on as a Header object where the header values list can be a list of strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)static HttpRequestrequest()static HttpRequeststatic String[]splitHostPort(String hostPort) update(HttpRequest requestOverride, HttpRequestModifier requestModifier) withBody(byte[] body) The body to match on as binary data such as a pdf or imageThe exact string body to match on such as "this is an exact string body"The exact string body to match on such as "this is an exact string body"The body match rules on such as using one of the Body subclasses as follows:withClientCertificateChain(List<X509Certificate> clientCertificateChain) withContentType(MediaType mediaType) withCookie(String name, String value) Adds one cookie to match on, which the value is plain strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withCookie(Cookie cookie) Adds one cookie to match on as a Cookie object where the cookie values list can be a list of strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withCookie(NottableString name, NottableString value) Adds one cookie to match on or to not match on using the NottableString, each NottableString can either be a positive matching value, such as string("match"), or a value to not match on, such as not("do not match"), the string values passed to the NottableString can be a plain string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withCookies(List<Cookie> cookies) The cookies to match on as a list of Cookie objects where the values or keys of each cookie can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withCookies(Cookie... cookies) The cookies to match on as a varags Cookie objects where the values or keys of each cookie can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withCookies(Cookies cookies) withHeader(String name, String... values) Adds one header to match which can specified using plain strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withHeader(Header header) Adds one header to match on as a Header object where the header values list can be a list of strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withHeader(NottableString name, NottableString... values) Adds one header to match on or to not match on using the NottableString, each NottableString can either be a positive matching value, such as string("match"), or a value to not match on, such as not("do not match"), the string values passed to the NottableString can also be a plain string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withHeaders(List<Header> headers) The headers to match on as a list of Header objects where the values or keys of each header can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withHeaders(Header... headers) The headers to match on as a varags of Header objects where the values or keys of each header can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withHeaders(Headers headers) withKeepAlive(Boolean isKeepAlive) Match on whether the request was made using an HTTP persistent connection, also called HTTP keep-alive, or HTTP connection reusewithLocalAddress(String localAddress) withMethod(String method) The HTTP method to match on such as "GET" or "POST"withMethod(NottableString method) The HTTP method all method except a specific value using the "not" operator, for example this allows operations such as not("GET")withMethodSchema(String method) The HTTP method to match on as a JSON Schema for example:withOriginalBody(byte[] originalBody) The path to match on such as "/some_mocked_path" any servlet context path is ignored for matching and should not be specified here regex values are also supported such as ".withPath(NottableString path) The path to not match on for example not("/some_mocked_path") with match any path not equal to "/some_mocked_path", the servlet context path is ignored for matching and should not be specified hereregex values are also supported such as not(".withPathParameter(String name, String... values) Adds one path parameter to match which can specified using plain strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withPathParameter(NottableString name, NottableString... values) Adds one path parameter to match on or to not match on using the NottableString, each NottableString can either be a positive matching value, such as string("match"), or a value to not match on, such as not("do not match"), the string values passed to the NottableString can also be a plain string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withPathParameter(Parameter parameter) Adds one path parameter to match on as a Parameter object where the parameter values list can be a list of strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withPathParameters(List<Parameter> parameters) The path parameter to match on as a list of Parameter objects where the values or keys of each parameter can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withPathParameters(Map<String, List<String>> parameters) The path parameter to match on as a Map<String, List<String>> where the values or keys of each parameter can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withPathParameters(Parameter... parameters) The path parameter to match on as a varags Parameter objects where the values or keys of each parameter can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withPathParameters(Parameters parameters) withPathSchema(String path) The path to match on as a JSON Schema for example:withProtocol(Protocol protocol) Match on whether the request was made over HTTP or HTTP2withQueryStringParameter(String name, String... values) Adds one query string parameter to match which the values are plain strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withQueryStringParameter(NottableString name, NottableString... values) Adds one query string parameter to match on or to not match on using the NottableString, each NottableString can either be a positive matching value, such as string("match"), or a value to not match on, such as not("do not match"), the string values passed to the NottableString can also be a plain string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withQueryStringParameter(Parameter parameter) Adds one query string parameter to match on as a Parameter object where the parameter values list can be a list of strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withQueryStringParameters(List<Parameter> parameters) The query string parameters to match on as a list of Parameter objects where the values or keys of each parameter can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withQueryStringParameters(Map<String, List<String>> parameters) The query string parameters to match on as a Map<String, List<String>> where the values or keys of each parameter can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withQueryStringParameters(Parameter... parameters) The query string parameters to match on as a varags Parameter objects where the values or keys of each parameter can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)withQueryStringParameters(Parameters parameters) withRemoteAddress(String remoteAddress) withRespondBeforeBody(Boolean respondBeforeBody) Match this request without waiting for the body to be received, and send the configured response before the body is consumed.withSchemaCookie(String name, String value) Adds one cookie to match on, which the value the values is JSON schema i.e. "{ \"type\": \"string\", \"pattern\": \"^someV[a-z]{4}$\" }" (for more details of the supported JSON schema see https://json-schema.org)withSchemaHeader(String name, String... values) Adds one header to match which the values are JSON schema i.e. "{ \"type\": \"string\", \"pattern\": \"^someV[a-z]{4}$\" }" (for more details of the supported JSON schema see https://json-schema.org)withSchemaPathParameter(String name, String... values) Adds one path parameter to match which the values are JSON schema i.e. "{ \"type\": \"string\", \"pattern\": \"^someV[a-z]{4}$\" }" (for more details of the supported JSON schema see https://json-schema.org)withSchemaQueryStringParameter(String name, String... values) Adds one query string parameter to match which the values are JSON schema i.e. "{ \"type\": \"string\", \"pattern\": \"^someV[a-z]{4}$\" }" (for more details of the supported JSON schema see https://json-schema.org)withSecure(Boolean isSecure) Match on whether the request was made over TLS or SSL (i.e.withSocketAddress(Boolean isSecure, String host, Integer port) Specify remote address by attempting to derive it from the host header and / or the specified portwithSocketAddress(String host, Integer port) Specify remote address by attempting to derive it from the host header and / or the specified portwithSocketAddress(String host, Integer port, SocketAddress.Scheme scheme) Specify remote address if the remote address can't be derived from the host header, if no value is specified the host header will be used to determine remote addresswithSocketAddress(SocketAddress socketAddress) Specify remote address if the remote address can't be derived from the host header, if no value is specified the host header will be used to determine remote addressSpecify remote address by attempting to derive it from the host headerwithStreamId(Integer streamId) HTTP2 stream id request was received onMethods inherited from class org.mockserver.model.RequestDefinition
cloneWithLogCorrelationId, getLogCorrelationId, withLogCorrelationIdMethods inherited from class org.mockserver.model.ObjectWithJsonToString
toStringMethods inherited from class org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
fieldsExcludedFromEqualsAndHashCode
-
Constructor Details
-
HttpRequest
public HttpRequest()
-
-
Method Details
-
request
-
request
-
get
-
post
-
put
-
delete
-
patch
-
head
-
options
-
isKeepAlive
-
withKeepAlive
Match on whether the request was made using an HTTP persistent connection, also called HTTP keep-alive, or HTTP connection reuse- Parameters:
isKeepAlive- true if the request was made with an HTTP persistent connection
-
isSecure
-
withSecure
Match on whether the request was made over TLS or SSL (i.e. HTTPS)- Parameters:
isSecure- true if the request was made with TLS or SSL
-
getRespondBeforeBody
-
withRespondBeforeBody
Match this request without waiting for the body to be received, and send the configured response before the body is consumed. Matchers with respondBeforeBody=true must not specify a body matcher and must use a RESPONSE or ERROR action; combine with connectionOptions.closeSocket=true on the response to close the connection after the response is sent. Useful for testing client behaviour when a server responds and closes mid-upload.- Parameters:
respondBeforeBody- true to dispatch the matched response before the request body is read
-
getProtocol
-
withProtocol
Match on whether the request was made over HTTP or HTTP2- Parameters:
protocol- used to indicate HTTP or HTTP2
-
getStreamId
-
withStreamId
HTTP2 stream id request was received on- Parameters:
streamId- HTTP2 stream id request was received on
-
getClientCertificateChain
-
withClientCertificateChain
-
getSocketAddress
-
withSocketAddress
Specify remote address if the remote address can't be derived from the host header, if no value is specified the host header will be used to determine remote address- Parameters:
socketAddress- the remote address to send request to
-
withSocketAddress
Specify remote address if the remote address can't be derived from the host header, if no value is specified the host header will be used to determine remote address- Parameters:
host- the remote host or ip to send request toport- the remote port to send request toscheme- the scheme to use for remote socket
-
withSocketAddress
Specify remote address by attempting to derive it from the host header and / or the specified port- Parameters:
host- the remote host or ip to send request toport- the remote port to send request to
-
withSocketAddressFromHostHeader
Specify remote address by attempting to derive it from the host header -
withSocketAddress
Specify remote address by attempting to derive it from the host header and / or the specified port- Parameters:
isSecure- true if the request was made with TLS or SSLhost- the remote host or ip to send request toport- the remote port to send request to
-
splitHostPort
-
withLocalAddress
-
getLocalAddress
-
withRemoteAddress
-
getRemoteAddress
-
withMethod
The HTTP method to match on such as "GET" or "POST"- Parameters:
method- the HTTP method such as "GET" or "POST"
-
withMethodSchema
The HTTP method to match on as a JSON Schema for example:{ "type": "string", "minLength": 2, "maxLength": 3 } or { "type": "string", "pattern": "^P.{2,3}$" } or { "type": "string", "format": "ipv4" }For full details of JSON Schema see, https://json-schema.org/understanding-json-schema/reference/string.html
- Parameters:
method- the HTTP method to match on as a JSON Schema
-
withMethod
The HTTP method all method except a specific value using the "not" operator, for example this allows operations such as not("GET")- Parameters:
method- the HTTP method to not match on not("GET") or not("POST")
-
getMethod
-
getMethod
-
withPath
The path to match on such as "/some_mocked_path" any servlet context path is ignored for matching and should not be specified here regex values are also supported such as ".*_path", see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for full details of the supported regex syntax- Parameters:
path- the path such as "/some_mocked_path" or a regex
-
withPath
The path to not match on for example not("/some_mocked_path") with match any path not equal to "/some_mocked_path", the servlet context path is ignored for matching and should not be specified hereregex values are also supported such as not(".*_path"), see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for full details of the supported regex syntax- Parameters:
path- the path to not match on such as not("/some_mocked_path") or not(".*_path")
-
withPathSchema
The path to match on as a JSON Schema for example:{ "type": "string", "minLength": 2, "maxLength": 3 } or { "type": "string", "pattern": "^simp.{2}$" } or { "type": "string", "format": "ipv4" }For full details of JSON Schema see, https://json-schema.org/understanding-json-schema/reference/string.html
- Parameters:
path- the path to match on as a JSON Schema
-
getPath
-
matches
-
matches
-
getPathParameters
-
withPathParameters
-
withPathParameters
The path parameter to match on as a list of Parameter objects where the values or keys of each parameter can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Parameters:
parameters- the list of Parameter objects where the values or keys of each parameter can be either a string or a regex
-
withPathParameters
The path parameter to match on as a varags Parameter objects where the values or keys of each parameter can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Parameters:
parameters- the varags Parameter objects where the values or keys of each parameter can be either a string or a regex
-
withPathParameters
The path parameter to match on as a Map<String, List<String>> where the values or keys of each parameter can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Parameters:
parameters- the Map<String, List<String>> object where the values or keys of each parameter can be either a string or a regex
-
withPathParameter
Adds one path parameter to match on as a Parameter object where the parameter values list can be a list of strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Parameters:
parameter- the Parameter object which can have a values list of strings or regular expressions
-
withPathParameter
Adds one path parameter to match which can specified using plain strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Parameters:
name- the parameter namevalues- the parameter values which can be a varags of strings or regular expressions
-
withSchemaPathParameter
Adds one path parameter to match which the values are JSON schema i.e. "{ \"type\": \"string\", \"pattern\": \"^someV[a-z]{4}$\" }" (for more details of the supported JSON schema see https://json-schema.org)- Parameters:
name- the parameter namevalues- the parameter values which can be a varags of JSON schemas
-
withPathParameter
Adds one path parameter to match on or to not match on using the NottableString, each NottableString can either be a positive matching value, such as string("match"), or a value to not match on, such as not("do not match"), the string values passed to the NottableString can also be a plain string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Parameters:
name- the parameter name as a NottableStringvalues- the parameter values which can be a varags of NottableStrings
-
getPathParameterList
-
hasPathParameter
-
hasPathParameter
-
getFirstPathParameter
-
getQueryStringParameters
-
withQueryStringParameters
-
withQueryStringParameters
The query string parameters to match on as a list of Parameter objects where the values or keys of each parameter can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Parameters:
parameters- the list of Parameter objects where the values or keys of each parameter can be either a string or a regex
-
withQueryStringParameters
The query string parameters to match on as a varags Parameter objects where the values or keys of each parameter can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Parameters:
parameters- the varags Parameter objects where the values or keys of each parameter can be either a string or a regex
-
withQueryStringParameters
The query string parameters to match on as a Map<String, List<String>> where the values or keys of each parameter can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Parameters:
parameters- the Map<String, List<String>> object where the values or keys of each parameter can be either a string or a regex
-
withQueryStringParameter
Adds one query string parameter to match on as a Parameter object where the parameter values list can be a list of strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Parameters:
parameter- the Parameter object which can have a values list of strings or regular expressions
-
withQueryStringParameter
Adds one query string parameter to match which the values are plain strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Parameters:
name- the parameter namevalues- the parameter values which can be a varags of strings or regular expressions
-
withSchemaQueryStringParameter
Adds one query string parameter to match which the values are JSON schema i.e. "{ \"type\": \"string\", \"pattern\": \"^someV[a-z]{4}$\" }" (for more details of the supported JSON schema see https://json-schema.org)- Parameters:
name- the parameter namevalues- the parameter values which can be a varags of JSON schemas
-
withQueryStringParameter
Adds one query string parameter to match on or to not match on using the NottableString, each NottableString can either be a positive matching value, such as string("match"), or a value to not match on, such as not("do not match"), the string values passed to the NottableString can also be a plain string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Parameters:
name- the parameter name as a NottableStringvalues- the parameter values which can be a varags of NottableStrings
-
getQueryStringParameterList
-
hasQueryStringParameter
-
hasQueryStringParameter
-
getFirstQueryStringParameter
-
withBody
The exact string body to match on such as "this is an exact string body"- Specified by:
withBodyin interfaceHttpMessage<HttpRequest,Body> - Parameters:
body- the body on such as "this is an exact string body"
-
withBody
The exact string body to match on such as "this is an exact string body"- Specified by:
withBodyin interfaceHttpMessage<HttpRequest,Body> - Parameters:
body- the body on such as "this is an exact string body"charset- character set the string will be encoded in
-
withBody
The body to match on as binary data such as a pdf or image- Specified by:
withBodyin interfaceHttpMessage<HttpRequest,Body> - Parameters:
body- a byte array
-
withBody
The body match rules on such as using one of the Body subclasses as follows:exact string match: - exact("this is an exact string body");
or
- new StringBody("this is an exact string body")
regular expression match: - regex("username[a-z]{4}");
or
- new RegexBody("username[a-z]{4}");
json match: - json("{username: 'foo', password: 'bar'}");
or
- json("{username: 'foo', password: 'bar'}", MatchType.STRICT);
or
- new JsonBody("{username: 'foo', password: 'bar'}");
json schema match: - jsonSchema("{type: 'object', properties: { 'username': { 'type': 'string' }, 'password': { 'type': 'string' } }, 'required': ['username', 'password']}");
or
- jsonSchemaFromResource("org/mockserver/model/loginSchema.json");
or
- new JsonSchemaBody("{type: 'object', properties: { 'username': { 'type': 'string' }, 'password': { 'type': 'string' } }, 'required': ['username', 'password']}");
xpath match: - xpath("/element[key = 'some_key' and value = 'some_value']");
or
- new XPathBody("/element[key = 'some_key' and value = 'some_value']");
body parameter match: - params( param("name_one", "value_one_one", "value_one_two") param("name_two", "value_two") );
or
- new ParameterBody( new Parameter("name_one", "value_one_one", "value_one_two") new Parameter("name_two", "value_two") );
binary match: - binary(IOUtils.readFully(getClass().getClassLoader().getResourceAsStream("example.pdf"), 1024));
or
- new BinaryBody(IOUtils.readFully(getClass().getClassLoader().getResourceAsStream("example.pdf"), 1024));
for more details of the supported regular expression syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more details of the supported json syntax see http://jsonassert.skyscreamer.org for more details of the supported json schema syntax see http://json-schema.org/ for more detail of XPath syntax see http://saxon.sourceforge.net/saxon6.5.3/expressions.html
- Specified by:
withBodyin interfaceHttpMessage<HttpRequest,Body> - Parameters:
body- an instance of one of the Body subclasses including StringBody, ParameterBody or BinaryBody
-
getBody
- Specified by:
getBodyin interfaceHttpMessage<HttpRequest,Body>
-
getBodyAsRawBytes
public byte[] getBodyAsRawBytes()- Specified by:
getBodyAsRawBytesin interfaceHttpMessage<HttpRequest,Body>
-
getOriginalBody
public byte[] getOriginalBody()When a request arrived with a Content-Encoding (e.g. gzip) and MockServer decompressed it, this holds the original bytes exactly as received on the wire (still compressed). It is null when the request body was not compressed, sogetBodyAsRawBytes()(the decompressed body) and this value together let you inspect both representations. A BinaryBody expectation matches against either representation. -
getBodyAsOriginalRawBytes
public byte[] getBodyAsOriginalRawBytes()- Returns:
- the original on-the-wire (compressed) body bytes when the request was compressed, otherwise the decompressed raw bytes — i.e. always the bytes as the client sent them.
-
withOriginalBody
-
getBodyAsString
- Specified by:
getBodyAsStringin interfaceHttpMessage<HttpRequest,Body>
-
getBodyAsJsonOrXmlString
-
getHeaders
- Specified by:
getHeadersin interfaceHttpMessage<HttpRequest,Body>
-
withHeaders
- Specified by:
withHeadersin interfaceHttpMessage<HttpRequest,Body>
-
withHeaders
The headers to match on as a list of Header objects where the values or keys of each header can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Specified by:
withHeadersin interfaceHttpMessage<HttpRequest,Body> - Parameters:
headers- the list of Header objects where the values or keys of each header can be either a string or a regex
-
withHeaders
The headers to match on as a varags of Header objects where the values or keys of each header can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Specified by:
withHeadersin interfaceHttpMessage<HttpRequest,Body> - Parameters:
headers- the varags of Header objects where the values or keys of each header can be either a string or a regex
-
withHeader
Adds one header to match on as a Header object where the header values list can be a list of strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Specified by:
withHeaderin interfaceHttpMessage<HttpRequest,Body> - Parameters:
header- the Header object which can have a values list of strings or regular expressions
-
withHeader
Adds one header to match which can specified using plain strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Specified by:
withHeaderin interfaceHttpMessage<HttpRequest,Body> - Parameters:
name- the header namevalues- the header values which can be a varags of strings or regular expressions
-
withSchemaHeader
Adds one header to match which the values are JSON schema i.e. "{ \"type\": \"string\", \"pattern\": \"^someV[a-z]{4}$\" }" (for more details of the supported JSON schema see https://json-schema.org)- Parameters:
name- the header namevalues- the header values which can be a varags of JSON schemas
-
withHeader
Adds one header to match on or to not match on using the NottableString, each NottableString can either be a positive matching value, such as string("match"), or a value to not match on, such as not("do not match"), the string values passed to the NottableString can also be a plain string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Specified by:
withHeaderin interfaceHttpMessage<HttpRequest,Body> - Parameters:
name- the header name as a NottableStringvalues- the header values which can be a varags of NottableStrings
-
withContentType
- Specified by:
withContentTypein interfaceHttpMessage<HttpRequest,Body>
-
replaceHeader
Adds one header to match on as a Header object where the header values list can be a list of strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Specified by:
replaceHeaderin interfaceHttpMessage<HttpRequest,Body> - Parameters:
header- the Header object which can have a values list of strings or regular expressions
-
getHeaderList
- Specified by:
getHeaderListin interfaceHttpMessage<HttpRequest,Body>
-
getHeader
- Specified by:
getHeaderin interfaceHttpMessage<HttpRequest,Body>
-
getFirstHeader
- Specified by:
getFirstHeaderin interfaceHttpMessage<HttpRequest,Body>
-
containsHeader
Returns true if a header with the specified name has been added- Specified by:
containsHeaderin interfaceHttpMessage<HttpRequest,Body> - Parameters:
name- the header name- Returns:
- true if a header has been added with that name otherwise false
-
containsHeader
Returns true if a header with the specified name and value has been added- Parameters:
name- the header namevalue- the header value- Returns:
- true if a header has been added with that name otherwise false
-
removeHeader
- Specified by:
removeHeaderin interfaceHttpMessage<HttpRequest,Body>
-
removeHeader
- Specified by:
removeHeaderin interfaceHttpMessage<HttpRequest,Body>
-
getCookies
- Specified by:
getCookiesin interfaceHttpMessage<HttpRequest,Body>
-
withCookies
- Specified by:
withCookiesin interfaceHttpMessage<HttpRequest,Body>
-
withCookies
The cookies to match on as a list of Cookie objects where the values or keys of each cookie can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Specified by:
withCookiesin interfaceHttpMessage<HttpRequest,Body> - Parameters:
cookies- a list of Cookie objects
-
withCookies
The cookies to match on as a varags Cookie objects where the values or keys of each cookie can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Specified by:
withCookiesin interfaceHttpMessage<HttpRequest,Body> - Parameters:
cookies- a varargs of Cookie objects
-
withCookie
Adds one cookie to match on as a Cookie object where the cookie values list can be a list of strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Specified by:
withCookiein interfaceHttpMessage<HttpRequest,Body> - Parameters:
cookie- a Cookie object
-
withCookie
Adds one cookie to match on, which the value is plain strings or regular expressions (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Specified by:
withCookiein interfaceHttpMessage<HttpRequest,Body> - Parameters:
name- the cookies namevalue- the cookies value
-
withSchemaCookie
Adds one cookie to match on, which the value the values is JSON schema i.e. "{ \"type\": \"string\", \"pattern\": \"^someV[a-z]{4}$\" }" (for more details of the supported JSON schema see https://json-schema.org)- Parameters:
name- the cookies namevalue- the cookies value as JSON schema
-
withCookie
Adds one cookie to match on or to not match on using the NottableString, each NottableString can either be a positive matching value, such as string("match"), or a value to not match on, such as not("do not match"), the string values passed to the NottableString can be a plain string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)- Specified by:
withCookiein interfaceHttpMessage<HttpRequest,Body> - Parameters:
name- the cookies namevalue- the cookies value
-
getCookieList
- Specified by:
getCookieListin interfaceHttpMessage<HttpRequest,Body>
-
socketAddressFromHostHeader
-
shallowClone
- Specified by:
shallowClonein classRequestDefinition
-
clone
-
update
-
equals
- Overrides:
equalsin classRequestDefinition
-
hashCode
public int hashCode()- Overrides:
hashCodein classRequestDefinition
-