Package org.mockserver.model
Class HttpRequestModifier
- java.lang.Object
-
- org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
-
- org.mockserver.model.ObjectWithJsonToString
-
- org.mockserver.model.HttpRequestModifier
-
public class HttpRequestModifier extends ObjectWithJsonToString
-
-
Constructor Summary
Constructors Constructor Description HttpRequestModifier()
-
Method Summary
-
Methods inherited from class org.mockserver.model.ObjectWithJsonToString
toString
-
Methods inherited from class org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
fieldsExcludedFromEqualsAndHashCode
-
-
-
-
Method Detail
-
requestModifier
public static HttpRequestModifier requestModifier()
-
getPath
public PathModifier getPath()
-
withPath
public HttpRequestModifier withPath(PathModifier path)
-
withPath
public HttpRequestModifier withPath(String regex, String substitution)
The regex and substitution values to use to modify matching substrings, if multiple matches are found they will all be modified with the substitution for full details of supported regex syntax see: http://docs.oracle.com/javase/7/docs/technotes/guides/security/SunProviders.html
The substitution can specify matching groups using $ followed by the group number for example $1
If a null or empty substitution string is provided the regex pattern will be used to remove any substring matching the regex
For example:
regex: ^/(.+)/(.+)$ substitution: /prefix/$1/infix/$2/postfix then: /some/path => /prefix/some/infix/path/postfix or: /some/longer/path => /prefix/some/infix/longer/path/postfix
- Parameters:
regex- regex value to match onsubstitution- the value to substitute for the regex
-
getQueryStringParameters
public QueryParametersModifier getQueryStringParameters()
-
withQueryStringParameters
public HttpRequestModifier withQueryStringParameters(QueryParametersModifier queryStringParameters)
-
withQueryStringParameters
public HttpRequestModifier withQueryStringParameters(Parameters add, Parameters replace, List<String> remove)
-
withQueryStringParameters
public HttpRequestModifier withQueryStringParameters(List<Parameter> add, List<Parameter> replace, List<String> remove)
-
getHeaders
public HeadersModifier getHeaders()
-
withHeaders
public HttpRequestModifier withHeaders(HeadersModifier headers)
-
withHeaders
public HttpRequestModifier withHeaders(List<Header> add, List<Header> replace, List<String> remove)
-
getCookies
public CookiesModifier getCookies()
-
withCookies
public HttpRequestModifier withCookies(CookiesModifier cookies)
-
withCookies
public HttpRequestModifier withCookies(List<Cookie> add, List<Cookie> replace, List<String> remove)
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classObjectWithReflectiveEqualsHashCodeToString
-
hashCode
public int hashCode()
- Overrides:
hashCodein classObjectWithReflectiveEqualsHashCodeToString
-
-