Hi,
I wonder if it's possible to set default request headers for all requests.
To be specific, I want to set "User-Agent" header for all requests in a following method (called at the tests setup phase):
static configure(String host, String user, String password) {
baseURI = host
authentication = preemptive().basic(user, password);
requestContentType(ContentType.JSON)
defaultParser = Parser.JSON
// TODO:
// set default User-Agent request header
}
AFAIK, there is no (easy) way how to achieve this with rest-assured.
I checked com.jayway.restassured.internal.RequestSpecificationImpl#setRequestHeadersToHttpBuilder and found no way hot set headers globally.
Am I missing something?
PS: With HTTPBuilder it's quite easy:
httpBuilder.defaultRequestHeaders.put('User-Agent', myUserAgent)