Class HttpGlueCode
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClear all default headers set in previous steps.voidModifies the global configuration of the HttpClient to not automatically follow redirects.voidResets the global configuration of the HttpClient to its default behaviour of automatically following redirects.voidsendEmptyRequest(io.restassured.http.Method method, URI address) Sends an empty request via the selected method.voidsendEmptyRequestNonBlocking(io.restassured.http.Method method, URI address) Sends an empty request via the selected method.voidsendEmptyRequestWithHeaders(io.restassured.http.Method method, URI address, io.cucumber.datatable.DataTable customHeaders) Sends an empty request via the selected method and expands the list of default headers with the headers provided by the caller.voidsendEmptyRequestWithHeadersNonBlocking(io.restassured.http.Method method, URI address, io.cucumber.datatable.DataTable customHeaders) Sends an empty request via the selected method and expands the list of default headers with the headers provided by the caller.voidsendRequestWithBody(io.restassured.http.Method method, URI address, String body) Sends a request containing the provided body via the selected method.voidsendRequestWithBodyNonBlocking(io.restassured.http.Method method, URI address, String body) Sends a request containing the provided body via the selected method.voidsendRequestWithMultiLineBody(io.restassured.http.Method method, URI address, String body) Sends a request via the selected method.voidsendRequestWithParams(io.restassured.http.Method method, URI address, io.cucumber.datatable.DataTable parameters) Sends a request via the selected method.voidsendRequestWithParamsNonBlocking(io.restassured.http.Method method, URI address, io.cucumber.datatable.DataTable parameters) Sends a request via the selected method.voidsetDefaultHeader(String header, String value) Expands the list of default headers with the provided key-value pair.voidsetDefaultHeaders(String docstring) Expands the list of default headers with the provided key-value pairs.
-
Field Details
-
KEY_HTTP_CLIENT
- See Also:
-
KEY_TIGER
- See Also:
-
KEY_DEFAULT_HEADER
- See Also:
-
-
Constructor Details
-
HttpGlueCode
public HttpGlueCode()
-
-
Method Details
-
sendEmptyRequest
@When("TGR send empty {requestType} request to {tigerResolvedUrl}") @Wenn("TGR eine leere {requestType} Anfrage an {tigerResolvedUrl} sendet") @Dann("TGR sende eine leere {requestType} Anfrage an {tigerResolvedUrl}") public void sendEmptyRequest(io.restassured.http.Method method, URI address) Sends an empty request via the selected method. Placeholders in address will be resolved.- Parameters:
method- HTTP request method (seeMethod)address- target address- See Also:
-
TigerGlobalConfiguration.resolvePlaceholders(String)
-
sendEmptyRequestNonBlocking
@When("TGR send empty {requestType} request to {tigerResolvedUrl} without waiting for the response") @Dann("TGR sende eine leere {requestType} Anfrage an {tigerResolvedUrl} ohne auf Antwort zu warten") public void sendEmptyRequestNonBlocking(io.restassured.http.Method method, URI address) Sends an empty request via the selected method. Placeholders in address will be resolved.This method is NON-BLOCKING, meaning it will not wait for the response before continuing the test.
- Parameters:
method- HTTP request method (seeMethod)address- target address- See Also:
-
TigerGlobalConfiguration.resolvePlaceholders(String)
-
sendEmptyRequestWithHeaders
@When("TGR send empty {requestType} request to {tigerResolvedUrl} with headers:") @Wenn("TGR eine leere {requestType} Anfrage an {tigerResolvedUrl} und den folgenden Headern sendet:") @Dann("TGR sende eine leere {requestType} Anfrage an {tigerResolvedUrl} mit folgenden Headern:") public void sendEmptyRequestWithHeaders(io.restassured.http.Method method, URI address, io.cucumber.datatable.DataTable customHeaders) Sends an empty request via the selected method and expands the list of default headers with the headers provided by the caller. Placeholders in address and in the data table will be resolved. Example:When TGR send empty GET request to "${myAddress}" with headers: | name | bob | | age | 27 |This will add two headers (name and age) with the respective values "bob" and "27" on top of the headers which are used by default.- Parameters:
method- HTTP request method (seeMethod)address- target addresscustomHeaders- Markdown table of custom headers and their values- See Also:
-
TigerGlobalConfiguration.resolvePlaceholders(String)
-
sendEmptyRequestWithHeadersNonBlocking
@When("TGR send empty {requestType} request to {tigerResolvedUrl} without waiting for the response with headers:") @Dann("TGR sende eine leere {requestType} Anfrage an {tigerResolvedUrl} ohne auf Antwort zu warten mit folgenden Headern:") public void sendEmptyRequestWithHeadersNonBlocking(io.restassured.http.Method method, URI address, io.cucumber.datatable.DataTable customHeaders) Sends an empty request via the selected method and expands the list of default headers with the headers provided by the caller. Placeholders in address and in the data table will be resolved.This method is NON-BLOCKING, meaning it will not wait for the response before continuing the test.
- Parameters:
method- HTTP request method (seeMethod)address- target addresscustomHeaders- Markdown table of custom headers and their values- See Also:
-
TigerGlobalConfiguration.resolvePlaceholders(String)
-
sendRequestWithBody
@When("TGR send {requestType} request to {tigerResolvedUrl} with body {string}") @Wenn("TGR eine leere {requestType} Anfrage an {tigerResolvedUrl} und dem folgenden body {string} sendet") @Dann("TGR sende eine {requestType} Anfrage an {tigerResolvedUrl} mit Body {string}") public void sendRequestWithBody(io.restassured.http.Method method, URI address, String body) Sends a request containing the provided body via the selected method. Placeholders in the body and in address will be resolved.- Parameters:
method- HTTP request method (seeMethod)body- to be included in the requestaddress- target address- See Also:
-
TigerGlobalConfiguration.resolvePlaceholders(String)
-
sendRequestWithBodyNonBlocking
@When("TGR send {requestType} request to {tigerResolvedUrl} with body {string} without waiting for the response") @Dann("TGR sende eine {requestType} Anfrage an {tigerResolvedUrl} mit Body {string} ohne auf Antwort zu warten") public void sendRequestWithBodyNonBlocking(io.restassured.http.Method method, URI address, String body) Sends a request containing the provided body via the selected method. Placeholders in the body and in address will be resolved.This method is NON-BLOCKING, meaning it will not wait for the response before continuing the test. ======= givenDefaultSpec() .body(resolve(body)) .request(method, new URI(resolveToString(address))); }
/** Expands the list of default headers with the provided key-value pair. If the key already exists, then the existing value is overwritten by the new value. Placeholders in the header name and in its value will be resolved. >>>>>>> master
- Parameters:
method- HTTP request method (seeMethod)body- to be included in the requestaddress- target address- See Also:
-
TigerGlobalConfiguration.resolvePlaceholders(String)
-
sendRequestWithParams
@When("TGR send {requestType} request to {tigerResolvedUrl} with:") @Wenn("TGR eine {requestType} Anfrage an {tigerResolvedUrl} mit den folgenden Daten sendet:") @Dann("TGR sende eine {requestType} Anfrage an {tigerResolvedUrl} mit folgenden Daten:") public void sendRequestWithParams(io.restassured.http.Method method, URI address, io.cucumber.datatable.DataTable parameters) Sends a request via the selected method. The request is expanded by the provided key-value pairs. Placeholders in keys and values will be resolved. The values must not be URL encoded, as this is done by the step. Example:When Send POST request to "http://my.address.com" with | ${configured_param_name} | state | redirect_uri | | client_id | ${configured_state_value} | https://my.redirect |
NOTE: This Markdown table must contain exactly 1 row of headers and 1 row of values.- Parameters:
method- HTTP request method (seeMethod)address- target addressparameters- to be sent with the request- See Also:
-
RequestSpecification.formParams(Map)TigerGlobalConfiguration.resolvePlaceholders(String)
-
sendRequestWithMultiLineBody
@When("TGR send {requestType} request to {tigerResolvedUrl} with multiline body:") @Wenn("TGR eine {requestType} Anfrage an {tigerResolvedUrl} mit den folgenden mehrzeiligen Daten sendet:") @Dann("TGR sende eine {requestType} Anfrage an {tigerResolvedUrl} mit folgenden mehrzeiligen Daten:") public void sendRequestWithMultiLineBody(io.restassured.http.Method method, URI address, String body) Sends a request via the selected method. For the given request's body placeholders in keys and values will be resolved. This step is meant to be used for more complex bodys spanning multiple lines.Example:
When TGR send POST request to "http://my.address.com" with multiline body: """ { "name": "value", "object": { "member": "value" }, "array" : [ 1,2,3,4] } """- Parameters:
method- HTTP request method (seeMethod)address- target addressbody- body content of the request- See Also:
-
TigerGlobalConfiguration.resolvePlaceholders(String)
-
sendRequestWithParamsNonBlocking
@When("TGR send {requestType} request to {tigerResolvedUrl} without waiting for the response with:") @Dann("TGR sende eine {requestType} Anfrage an {tigerResolvedUrl} ohne auf Antwort zu warten mit folgenden Daten:") public void sendRequestWithParamsNonBlocking(io.restassured.http.Method method, URI address, io.cucumber.datatable.DataTable parameters) Sends a request via the selected method. The request is expanded by the provided key-value pairs. Placeholders in keys and values will be resolved. The values must not be URL encoded, as this is done by the step.This method is NON-BLOCKING, meaning it will not wait for the response before continuing the test.
- Parameters:
method- HTTP request method (seeMethod)address- target addressparameters- to be sent with the request- See Also:
-
RequestSpecification.formParams(Map)TigerGlobalConfiguration.resolvePlaceholders(String)
-
setDefaultHeader
@When("TGR set default header {tigerResolvedString} to {tigerResolvedString}") @Wenn("TGR den default header {tigerResolvedString} auf den Wert {tigerResolvedString} setzen") @Dann("TGR setze den default header {tigerResolvedString} auf den Wert {tigerResolvedString}") public void setDefaultHeader(String header, String value) Expands the list of default headers with the provided key-value pair. If the key already exists, then the existing value is overwritten by the new value. Placeholders in the header name and in its value will be resolved.- Parameters:
header- keyvalue- to be stored under the given key- See Also:
-
TigerGlobalConfiguration.resolvePlaceholders(String)
-
setDefaultHeaders
@When("TGR set default headers:") @Dann("TGR setze folgende default headers:") @Wenn("TGR folgende default headers gesetzt werden:") public void setDefaultHeaders(String docstring) Expands the list of default headers with the provided key-value pairs. If the key already exists, then the existing value is overwritten by the new value. Placeholders in the header names and in their values will be resolved.- Parameters:
docstring- multiline doc string, one key value pair per line- See Also:
-
TigerGlobalConfiguration.resolvePlaceholders(String)
-
clearDefaultHeaders
@When("TGR clear all default headers") @Wenn("TGR l\u00f6sche alle default headers") public void clearDefaultHeaders()Clear all default headers set in previous steps. -
disableHttpClientFollowRedirects
@When("TGR disable HttpClient followRedirects configuration") @Wenn("TGR HttpClient followRedirects Konfiguration deaktiviert") public void disableHttpClientFollowRedirects()Modifies the global configuration of the HttpClient to not automatically follow redirects. All following requests will use the modified configuration. -
resetHttpClientRedirectConfiguration
@When("TGR reset HttpClient followRedirects configuration") @Wenn("TGR HttpClient followRedirects Konfiguration zur\u00fccksetzt") public void resetHttpClientRedirectConfiguration()Resets the global configuration of the HttpClient to its default behaviour of automatically following redirects.
-