public class RequestSpecBuilder extends Object
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build(); RequestSpecification requestSpec = new RequestSpecBuilder().addParam("parameter1", "value1").build(); given(responseSpec, requestSpec).post("/something");or
RequestSpecification requestSpec = new RequestSpecBuilder().addParameter("parameter1", "value1").build(); given(). spec(requestSpec). expect(). body("x.y.z", equalTo("something")). when(). get("/something");
Constructor and Description |
---|
RequestSpecBuilder() |
Modifier and Type | Method and Description |
---|---|
RequestSpecBuilder |
addCookie(Cookie cookie)
Add a detailed cookie
|
RequestSpecBuilder |
addCookie(String name)
Add a cookie without value to be sent with the request.
|
RequestSpecBuilder |
addCookie(String key,
Object value,
Object... cookieNameValuePairs)
Add a cookie to be sent with the request.
|
RequestSpecBuilder |
addCookies(Cookies cookies)
Specify multiple detailed cookies that'll be sent with the request.
|
RequestSpecBuilder |
addCookies(Map<String,?> cookies)
Add cookies to be sent with the request as Map e.g:
|
RequestSpecBuilder |
addFilter(Filter filter)
Add a filter that will be used in the request.
|
RequestSpecBuilder |
addFilters(List<Filter> filters)
Add filters that will be used in the request.
|
RequestSpecBuilder |
addFormParam(String parameterName,
Collection<?> parameterValues)
Add a form parameter to be sent with the request.
|
RequestSpecBuilder |
addFormParam(String parameterName,
Object... parameterValues)
Add a form parameter to be sent with the request.
|
RequestSpecBuilder |
addFormParams(Map<String,?> parametersMap)
Add query parameters to be sent with the request as a Map.
|
RequestSpecBuilder |
addHeader(String headerName,
String headerValue)
Add a header to be sent with the request e.g:
|
RequestSpecBuilder |
addHeaders(Map<String,String> headers)
Add headers to be sent with the request as Map.
|
RequestSpecBuilder |
addMultiPart(File file)
Specify a file to upload to the server using multi-part form data uploading.
|
RequestSpecBuilder |
addMultiPart(MultiPartSpecification multiPartSpecification)
Specify a multi-part specification.
|
RequestSpecBuilder |
addMultiPart(String controlName,
File file)
Specify a file to upload to the server using multi-part form data uploading with a specific
control name.
|
RequestSpecBuilder |
addMultiPart(String controlName,
File file,
String mimeType)
Specify a file to upload to the server using multi-part form data uploading with a specific
control name and content-type.
|
RequestSpecBuilder |
addMultiPart(String controlName,
String contentBody)
Specify a string to send to the server using multi-part form data.
|
RequestSpecBuilder |
addMultiPart(String controlName,
String fileName,
byte[] bytes)
Specify a byte-array to upload to the server using multi-part form data.
|
RequestSpecBuilder |
addMultiPart(String controlName,
String fileName,
byte[] bytes,
String mimeType)
Specify a byte-array to upload to the server using multi-part form data.
|
RequestSpecBuilder |
addMultiPart(String controlName,
String fileName,
InputStream stream)
Specify an inputstream to upload to the server using multi-part form data.
|
RequestSpecBuilder |
addMultiPart(String controlName,
String fileName,
InputStream stream,
String mimeType)
Specify an inputstream to upload to the server using multi-part form data.
|
RequestSpecBuilder |
addMultiPart(String controlName,
String contentBody,
String mimeType)
Specify a string to send to the server using multi-part form data with a specific mime-type.
|
RequestSpecBuilder |
addParam(String parameterName,
Collection<?> parameterValues)
Add a multi-value parameter to be sent with the request.
|
RequestSpecBuilder |
addParam(String parameterName,
Object... parameterValues)
Add a parameter to be sent with the request.
|
RequestSpecBuilder |
addParams(Map<String,?> parametersMap)
Add parameters to be sent with the request as Map.
|
RequestSpecBuilder |
addPathParam(String parameterName,
Object parameterValue)
Specify a path parameter.
|
RequestSpecBuilder |
addPathParams(Map<String,?> parameterNameValuePairs)
Specify multiple path parameter name-value pairs.
|
RequestSpecBuilder |
addPathParams(String firstParameterName,
Object firstParameterValue,
Object... parameterNameValuePairs)
Specify multiple path parameter name-value pairs.
|
RequestSpecBuilder |
addQueryParam(String parameterName,
Collection<?> parameterValues)
Add a query parameter to be sent with the request.
|
RequestSpecBuilder |
addQueryParam(String parameterName,
Object... parameterValues)
Add a query parameter to be sent with the request.
|
RequestSpecBuilder |
addQueryParams(Map<String,?> parametersMap)
Add query parameters to be sent with the request as a Map.
|
RequestSpecBuilder |
addRequestSpecification(RequestSpecification specification)
Merge this builder with settings from another specification.
|
RequestSpecBuilder |
and()
Syntactic sugar.
|
RequestSpecification |
build()
Build RequestSpecBuilder.
|
RequestSpecBuilder |
log(LogDetail logDetail)
Enabled logging with the specified log detail.
|
RequestSpecBuilder |
removeFormParam(String parameterName)
Method to remove parameter added with
addFormParam(String, Object...) from map. |
RequestSpecBuilder |
removeParam(String parameterName)
Method to remove parameter added with
addParam(String, Object...) from map. |
RequestSpecBuilder |
removePathParam(String parameterName)
Method to remove parameter added with
addPathParam(String, Object) from map. |
RequestSpecBuilder |
removeQueryParam(String parameterName)
Method to remove parameter added with from map.
|
RequestSpecBuilder |
setAccept(ContentType contentType)
Specify the accept header of the request.
|
RequestSpecBuilder |
setAccept(String mediaTypes)
Specify the accept header of the request.
|
RequestSpecBuilder |
setAuth(AuthenticationScheme auth)
If you need to specify some credentials when performing a request.
|
RequestSpecBuilder |
setBasePath(String path)
Set the base path that's prepended to each path by REST assured when making requests.
|
RequestSpecBuilder |
setBaseUri(String uri)
Add the baseUri property from the RequestSpecBuilder instead of using static field RestAssured.baseURI.
|
RequestSpecBuilder |
setBaseUri(URI uri)
Add the baseUri property from the RequestSpecBuilder instead of using static field RestAssured.baseURI.
|
RequestSpecBuilder |
setBody(byte[] body)
Specify a byte array request body to be sent with the request.
|
RequestSpecBuilder |
setBody(Object object)
Specify an Object request content that will automatically be serialized to JSON or XML and sent with the request.
|
RequestSpecBuilder |
setBody(Object object,
ObjectMapper mapper)
Specify an Object request content that will automatically be serialized to JSON or XML and sent with the request using a specific object mapper.
|
RequestSpecBuilder |
setBody(Object object,
ObjectMapperType mapperType)
Specify an Object request content that will automatically be serialized to JSON or XML and sent with the request using a specific object mapper type.
|
RequestSpecBuilder |
setBody(String body)
Specify a String request body (such as e.g.
|
RequestSpecBuilder |
setConfig(RestAssuredConfig config)
Define a configuration for redirection settings and http client parameters.
|
RequestSpecBuilder |
setContentType(ContentType contentType)
Specify the content type of the request.
|
RequestSpecBuilder |
setContentType(String contentType)
Specify the content type of the request as string.
|
RequestSpecBuilder |
setKeyStore(KeyStore keyStore)
Use the supplied keystore for HTTPS requests.
|
RequestSpecBuilder |
setKeyStore(String pathToJks,
String password)
Specify a keystore.
|
RequestSpecBuilder |
setPort(int port)
Specify the port.
|
RequestSpecBuilder |
setProxy(int port)
Instruct REST Assured to connect to a proxy on the specified port on localhost.
|
RequestSpecBuilder |
setProxy(ProxySpecification proxySpecification)
Instruct REST Assured to connect to a proxy using a
ProxySpecification . |
RequestSpecBuilder |
setProxy(String host)
Instruct REST Assured to connect to a proxy on the specified host on port
8888 . |
RequestSpecBuilder |
setProxy(String host,
int port)
Instruct REST Assured to connect to a proxy on the specified host and port.
|
RequestSpecBuilder |
setProxy(String host,
int port,
String scheme)
Instruct REST Assured to connect to a proxy on the specified port on localhost with a specific scheme.
|
RequestSpecBuilder |
setProxy(URI uri)
Instruct REST Assured to connect to a proxy using a URI.
|
RequestSpecBuilder |
setRelaxedHTTPSValidation()
Use relaxed HTTP validation with SSLContext protocol .
|
RequestSpecBuilder |
setRelaxedHTTPSValidation(String protocol)
Use relaxed HTTP validation with a given SSLContext protocol.
|
RequestSpecBuilder |
setSessionId(String sessionIdValue)
Set the session id for this request.
|
RequestSpecBuilder |
setSessionId(String sessionIdName,
String sessionIdValue)
Set the session id name and value for this request.
|
RequestSpecBuilder |
setTrustStore(File pathToJks,
String password)
The following documentation is taken from https://github.com/jgritman/httpbuilder/wiki/SSL:
|
RequestSpecBuilder |
setTrustStore(KeyStore trustStore)
Use the supplied truststore for HTTPS requests.
|
RequestSpecBuilder |
setTrustStore(String pathToJks,
String password)
The following documentation is taken from https://github.com/jgritman/httpbuilder/wiki/SSL:
|
RequestSpecBuilder |
setUrlEncodingEnabled(boolean isEnabled)
Specifies if Rest Assured should url encode the URL automatically.
|
public RequestSpecBuilder setBody(String body)
body
- The body to send.public RequestSpecBuilder setBody(byte[] body)
body
- The body to send.public RequestSpecBuilder setBody(Object object)
object
- The object to serialize and send with the requestpublic RequestSpecBuilder setBody(Object object, ObjectMapper mapper)
object
- The object to serialize and send with the requestmapper
- The object mapperpublic RequestSpecBuilder setBody(Object object, ObjectMapperType mapperType)
Example of use:
Message message = new Message(); message.setMessage("My beautiful message"); given(). body(message, ObjectMapper.GSON). expect(). content(equalTo("Response to a beautiful message")). when(). post("/beautiful-message");
object
- The object to serialize and send with the requestmapperType
- The object mapper type to be usedpublic RequestSpecBuilder addCookies(Map<String,?> cookies)
cookies
- The Map containing the cookie names and their values to set in the request.public RequestSpecBuilder addCookie(Cookie cookie)
cookie
- The cookie to add.public RequestSpecBuilder addCookie(String key, Object value, Object... cookieNameValuePairs)
key
- The cookie keyvalue
- The cookie valuecookieNameValuePairs
- Additional cookies values. This will actually create two cookies with the same name but with different values.public RequestSpecBuilder addCookie(String name)
name
- The cookie namepublic RequestSpecBuilder addCookies(Cookies cookies)
cookies
- The cookies to set in the request.RequestSpecification.cookies(Cookies)
public RequestSpecBuilder addFilter(Filter filter)
filter
- The filter to addpublic RequestSpecBuilder addFilters(List<Filter> filters)
filters
- The filters to addpublic RequestSpecBuilder addParams(Map<String,?> parametersMap)
parametersMap
- The Map containing the parameter names and their values to send with the request.public RequestSpecBuilder addParam(String parameterName, Object... parameterValues)
parameterName
- The parameter nameparameterValues
- Zero to many parameter values for this parameter name.public RequestSpecBuilder addParam(String parameterName, Collection<?> parameterValues)
parameterName
- The parameter keyparameterValues
- The parameter valuespublic RequestSpecBuilder removeParam(String parameterName)
addParam(String, Object...)
from map.
Removes all values of this parameterparameterName
- The parameter keypublic RequestSpecBuilder addQueryParam(String parameterName, Collection<?> parameterValues)
addParam(String, java.util.Collection)
for all HTTP methods except POST where this method can be used to differentiate between form and query params.parameterName
- The parameter keyparameterValues
- The parameter valuesaddQueryParam(String, Object...)
public RequestSpecBuilder addQueryParams(Map<String,?> parametersMap)
addParams(java.util.Map)
for all HTTP methods except POST where this method can be used to differentiate between form and query params.parametersMap
- The Map containing the parameter names and their values to send with the request.public RequestSpecBuilder addQueryParam(String parameterName, Object... parameterValues)
addParam(String, Object...)
)}
for all HTTP methods except POST where this method can be used to differentiate between form and query params.parameterName
- The parameter keyparameterValues
- Zero to many parameter values for this parameter name.public RequestSpecBuilder removeQueryParam(String parameterName)
parameterName
- The parameter keypublic RequestSpecBuilder addFormParam(String parameterName, Collection<?> parameterValues)
addParam(String, java.util.Collection)
for all HTTP methods except PUT where this method can be used to differentiate between form and query params.parameterName
- The parameter keyparameterValues
- The parameter valuesaddFormParam(String, Object...)
public RequestSpecBuilder addFormParams(Map<String,?> parametersMap)
addParams(java.util.Map)
for all HTTP methods except POST where this method can be used to differentiate between form and query params.parametersMap
- The Map containing the parameter names and their values to send with the request.public RequestSpecBuilder addFormParam(String parameterName, Object... parameterValues)
addParam(String, Object...)
)}
for all HTTP methods except PUT where this method can be used to differentiate between form and query params.parameterName
- The parameter keyparameterValues
- Zero to many parameter values for this parameter name.addFormParam(String, Object...)
public RequestSpecBuilder removeFormParam(String parameterName)
addFormParam(String, Object...)
from map.
Removes all values of this parameterparameterName
- The parameter keypublic RequestSpecBuilder addPathParam(String parameterName, Object parameterValue)
expect().statusCode(200).when().get("/item/"+myItem.getItemNumber()+"/buy/"+2);you can write:
given(). pathParam("itemNumber", myItem.getItemNumber()). pathParam("amount", 2). expect(). statusCode(200). when(). get("/item/{itemNumber}/buy/{amount}");which improves readability and allows the path to be reusable in many tests. Another alternative is to use:
expect().statusCode(200).when().get("/item/{itemNumber}/buy/{amount}", myItem.getItemNumber(), 2);
parameterName
- The parameter keyparameterValue
- The parameter valuepublic RequestSpecBuilder addPathParams(String firstParameterName, Object firstParameterValue, Object... parameterNameValuePairs)
expect().statusCode(200).when().get("/item/"+myItem.getItemNumber()+"/buy/"+2);you can write:
given(). pathParam("itemNumber", myItem.getItemNumber(), "amount", 2). expect(). statusCode(200). when(). get("/item/{itemNumber}/buy/{amount}");which improves readability and allows the path to be reusable in many tests. Another alternative is to use:
expect().statusCode(200).when().get("/item/{itemNumber}/buy/{amount}", myItem.getItemNumber(), 2);
firstParameterName
- The name of the first parameterfirstParameterValue
- The value of the first parameterparameterNameValuePairs
- Additional parameters in name-value pairs.public RequestSpecBuilder addPathParams(Map<String,?> parameterNameValuePairs)
expect().statusCode(200).when().get("/item/"+myItem.getItemNumber()+"/buy/"+2);you can write:
Map<String,Object> pathParams = new HashMap<String,Object>(); pathParams.add("itemNumber",myItem.getItemNumber()); pathParams.add("amount",2); given(). pathParameters(pathParams). expect(). statusCode(200). when(). get("/item/{itemNumber}/buy/{amount}");which improves readability and allows the path to be reusable in many tests. Another alternative is to use:
expect().statusCode(200).when().get("/item/{itemNumber}/buy/{amount}", myItem.getItemNumber(), 2);
parameterNameValuePairs
- A map containing the path parameters.public RequestSpecBuilder removePathParam(String parameterName)
addPathParam(String, Object)
from map.
Removes all values of this parameter.parameterName
- The parameter keypublic RequestSpecBuilder setKeyStore(String pathToJks, String password)
RestAssured.keyStore("/truststore_javanet.jks", "test1234");or
given().keyStore("/truststore_javanet.jks", "test1234"). ..
pathToJks
- The path to the JKSpassword
- The store passpublic RequestSpecBuilder setTrustStore(String pathToJks, String password)
$ keytool -printcert -file EquifaxSecureGlobaleBusinessCA-1.crt Owner: CN=Equifax Secure Global eBusiness CA-1, O=Equifax Secure Inc., C=US Issuer: CN=Equifax Secure Global eBusiness CA-1, O=Equifax Secure Inc., C=US Serial number: 1 Valid from: Mon Jun 21 00:00:00 EDT 1999 until: Sun Jun 21 00:00:00 EDT 2020 Certificate fingerprints: MD5: 8F:5D:77:06:27:C4:98:3C:5B:93:78:E7:D7:7D:9B:CC SHA1: 7E:78:4A:10:1C:82:65:CC:2D:E1:F1:6D:47:B4:40:CA:D9:0A:19:45 Signature algorithm name: MD5withRSA Version: 3 ....Now, import that into a Java keystore file:
$ keytool -importcert -alias "equifax-ca" -file EquifaxSecureGlobaleBusinessCA-1.crt -keystore truststore_javanet.jks -storepass test1234 Owner: CN=Equifax Secure Global eBusiness CA-1, O=Equifax Secure Inc., C=US Issuer: CN=Equifax Secure Global eBusiness CA-1, O=Equifax Secure Inc., C=US Serial number: 1 Valid from: Mon Jun 21 00:00:00 EDT 1999 until: Sun Jun 21 00:00:00 EDT 2020 Certificate fingerprints: MD5: 8F:5D:77:06:27:C4:98:3C:5B:93:78:E7:D7:7D:9B:CC SHA1: 7E:78:4A:10:1C:82:65:CC:2D:E1:F1:6D:47:B4:40:CA:D9:0A:19:45 Signature algorithm name: MD5withRSA Version: 3 ... Trust this certificate? [no]: yes Certificate was added to keystoreNow you want to use this truststore in your client:
RestAssured.trustStore("/truststore_javanet.jks", "test1234");or
given().trustStore("/truststore_javanet.jks", "test1234"). ..
pathToJks
- The path to the JKSpassword
- The store passpublic RequestSpecBuilder setTrustStore(File pathToJks, String password)
$ keytool -printcert -file EquifaxSecureGlobaleBusinessCA-1.crt Owner: CN=Equifax Secure Global eBusiness CA-1, O=Equifax Secure Inc., C=US Issuer: CN=Equifax Secure Global eBusiness CA-1, O=Equifax Secure Inc., C=US Serial number: 1 Valid from: Mon Jun 21 00:00:00 EDT 1999 until: Sun Jun 21 00:00:00 EDT 2020 Certificate fingerprints: MD5: 8F:5D:77:06:27:C4:98:3C:5B:93:78:E7:D7:7D:9B:CC SHA1: 7E:78:4A:10:1C:82:65:CC:2D:E1:F1:6D:47:B4:40:CA:D9:0A:19:45 Signature algorithm name: MD5withRSA Version: 3 ....Now, import that into a Java keystore file:
$ keytool -importcert -alias "equifax-ca" -file EquifaxSecureGlobaleBusinessCA-1.crt -keystore truststore_javanet.jks -storepass test1234 Owner: CN=Equifax Secure Global eBusiness CA-1, O=Equifax Secure Inc., C=US Issuer: CN=Equifax Secure Global eBusiness CA-1, O=Equifax Secure Inc., C=US Serial number: 1 Valid from: Mon Jun 21 00:00:00 EDT 1999 until: Sun Jun 21 00:00:00 EDT 2020 Certificate fingerprints: MD5: 8F:5D:77:06:27:C4:98:3C:5B:93:78:E7:D7:7D:9B:CC SHA1: 7E:78:4A:10:1C:82:65:CC:2D:E1:F1:6D:47:B4:40:CA:D9:0A:19:45 Signature algorithm name: MD5withRSA Version: 3 ... Trust this certificate? [no]: yes Certificate was added to keystoreNow you want to use this truststore in your client:
RestAssured.trustStore("/truststore_javanet.jks", "test1234");or
given().trustStore("/truststore_javanet.jks", "test1234"). ..
pathToJks
- The path to the JKSpassword
- The store passpublic RequestSpecBuilder addHeaders(Map<String,String> headers)
headers
- The Map containing the header names and their values to send with the request.public RequestSpecBuilder addHeader(String headerName, String headerValue)
headerName
- The header nameheaderValue
- The header valuepublic RequestSpecBuilder setContentType(ContentType contentType)
contentType
- The content type of the requestContentType
public RequestSpecBuilder setContentType(String contentType)
contentType
- The content type of the requestpublic RequestSpecBuilder setAccept(ContentType contentType)
addHeader("Accept", contentType);
contentType
- The content type whose accept header ContentType.getAcceptHeader()
will be used as Accept header in the request.ContentType
,
addHeader(String, String)
public RequestSpecBuilder setAccept(String mediaTypes)
header("Accept", contentType);
mediaTypes
- The media type(s) that will be used as Accept header in the request.ContentType
,
addHeader(String, String)
public RequestSpecBuilder addMultiPart(MultiPartSpecification multiPartSpecification)
multiPartSpecification
- Multipart specificationpublic RequestSpecBuilder addMultiPart(File file)
file
- The file to uploadpublic RequestSpecBuilder addMultiPart(String controlName, File file)
file
- The file to uploadcontrolName
- Defines the control name of the body part. In HTML this is the attribute name of the input tag.public RequestSpecBuilder addMultiPart(String controlName, File file, String mimeType)
file
- The file to uploadcontrolName
- Defines the control name of the body part. In HTML this is the attribute name of the input tag.mimeType
- The content-typepublic RequestSpecBuilder addMultiPart(String controlName, String fileName, byte[] bytes)
controlName
- Defines the control name of the body part. In HTML this is the attribute name of the input tag.fileName
- The name of the content you're uploadingbytes
- The bytes you want to sendpublic RequestSpecBuilder addMultiPart(String controlName, String fileName, byte[] bytes, String mimeType)
controlName
- Defines the control name of the body part. In HTML this is the attribute name of the input tag.fileName
- The name of the content you're uploadingbytes
- The bytes you want to sendmimeType
- The content-typepublic RequestSpecBuilder addMultiPart(String controlName, String fileName, InputStream stream)
controlName
- Defines the control name of the body part. In HTML this is the attribute name of the input tag.fileName
- The name of the content you're uploadingstream
- The stream you want to sendpublic RequestSpecBuilder addMultiPart(String controlName, String fileName, InputStream stream, String mimeType)
controlName
- Defines the control name of the body part. In HTML this is the attribute name of the input tag.fileName
- The name of the content you're uploadingstream
- The stream you want to sendmimeType
- The content-typepublic RequestSpecBuilder addMultiPart(String controlName, String contentBody)
controlName
- Defines the control name of the body part. In HTML this is the attribute name of the input tag.contentBody
- The string to sendpublic RequestSpecBuilder addMultiPart(String controlName, String contentBody, String mimeType)
controlName
- Defines the control name of the body part. In HTML this is the attribute name of the input tag.contentBody
- The string to sendmimeType
- The mime-typepublic RequestSpecBuilder setAuth(AuthenticationScheme auth)
public RequestSpecBuilder setPort(int port)
port
- The port of URIpublic RequestSpecBuilder setUrlEncodingEnabled(boolean isEnabled)
isEnabled
- Specify whether or not URL encoding should be enabled or disabled.public RequestSpecBuilder setSessionId(String sessionIdValue)
RestAssured.config = newConfig().sessionConfig(new SessionConfig().sessionIdName(<sessionIdName>));or you can use the
setSessionId(String, String)
method to set it for this request only.sessionIdValue
- The session id value.public RequestSpecBuilder setSessionId(String sessionIdName, String sessionIdValue)
RestAssured.config = newConfig().sessionConfig(new SessionConfig().sessionIdName(<sessionIdName>));and then you can use the
setSessionId(String)
method to set the session id value without specifying the name for each request.sessionIdName
- The session id namesessionIdValue
- The session id value.public RequestSpecBuilder addRequestSpecification(RequestSpecification specification)
specification
- The specification to addpublic RequestSpecBuilder setConfig(RestAssuredConfig config)
config
- The configuration to use for this request. If null
no config will be used.public RequestSpecification build()
public RequestSpecBuilder setBaseUri(String uri)
RequestSpecBuilder builder = new RequestSpecBuilder(); builder.setBaseUri("http://example.com"); RequestSpecification specs = builder.build(); given().specification(specs)
uri
- The URIpublic RequestSpecBuilder setBaseUri(URI uri)
RequestSpecification specs = new RequestSpecBuilder() .setBaseUri(URI.create("http://example.com")) .build(); given().specification(specs)uses
setBaseUri(String)
uri
- The URIpublic RequestSpecBuilder setBasePath(String path)
http://localhost
and basePath
is /resource
then
..when().get("/something");will make a request to
http://localhost/resource
.path
- The base path to set.public RequestSpecBuilder log(LogDetail logDetail)
LogConfig
to configure the print stream and pretty printing options.logDetail
- The log detail.public RequestSpecBuilder setTrustStore(KeyStore trustStore)
given().config(RestAssured.config().sslConfig(sslConfig().trustStore(truststore));
trustStore
- The truststore.setKeyStore(String, String)
public RequestSpecBuilder setKeyStore(KeyStore keyStore)
given().config(RestAssured.config().sslConfig(sslConfig().keyStore(keystore));
keyStore
- The truststore.setKeyStore(String, String)
public RequestSpecBuilder setRelaxedHTTPSValidation()
setKeyStore(String, String)
or trust store (see setTrustStore(java.security.KeyStore)
.
This is just a shortcut for:
given().config(RestAssured.config().sslConfig(sslConfig().relaxedHTTPSValidation())). ..;
public RequestSpecBuilder setRelaxedHTTPSValidation(String protocol)
setKeyStore(String, String)
or trust store (see setTrustStore(java.security.KeyStore)
.
This is just a shortcut for:
given().config(RestAssured.config().sslConfig(sslConfig().relaxedHTTPSValidation())). ..;
protocol
- The standard name of the requested protocol. See the SSLContext section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard protocol names.public RequestSpecBuilder setProxy(String host, int port)
host
- The hostname of the proxy to connect to (for example 127.0.0.1
)port
- The port of the proxy to connect to (for example 8888
)public RequestSpecBuilder setProxy(String host)
8888
.host
- The hostname of the proxy to connect to (for example 127.0.0.1
). Can also be a URI represented as a String.setProxy(String)
public RequestSpecBuilder setProxy(int port)
port
- The port of the proxy to connect to (for example 8888
)setProxy(int)
public RequestSpecBuilder setProxy(String host, int port, String scheme)
host
- The hostname of the proxy to connect to (for example 127.0.0.1
)port
- The port of the proxy to connect to (for example 8888
)scheme
- The http scheme (http or https)public RequestSpecBuilder setProxy(URI uri)
uri
- The URI of the proxypublic RequestSpecBuilder setProxy(ProxySpecification proxySpecification)
ProxySpecification
.proxySpecification
- The proxy specification to use.RequestSpecification.proxy(ProxySpecification)
public RequestSpecBuilder and()
Copyright © 2010–2019. All rights reserved.