Class ApiHelper

java.lang.Object
net.bugreaper.modules.api.internal.ApiHelper

public class ApiHelper extends Object
  • Field Details

    • logger

      protected org.slf4j.Logger logger
    • url

      protected String url
    • port

      protected int port
    • useBasicAuth

      protected volatile boolean useBasicAuth
    • authToken

      protected volatile String authToken
    • username

      protected volatile String username
    • password

      protected volatile String password
    • enableLogging

      protected volatile boolean enableLogging
    • headers

      protected final Map<String,Object> headers
    • queryParams

      protected final Map<String,Object> queryParams
    • requestQueryParams

      protected ThreadLocal<LinkedHashMap<String,Object>> requestQueryParams
    • requestHeaders

      protected ThreadLocal<LinkedHashMap<String,Object>> requestHeaders
    • maxResponseMsAssert

      protected volatile long maxResponseMsAssert
      Default response timeout (not brake request, only assert)
    • maxTimeoutMs

      protected volatile int maxTimeoutMs
      Default connection and socket timeout for http connection
    • contentType

      protected volatile io.restassured.http.ContentType contentType
      Default content type JSON
  • Constructor Details

    • ApiHelper

      public ApiHelper(String url, int port, net.bugreaper.core.config.ConfigMap options, org.slf4j.Logger logger)
    • ApiHelper

      public ApiHelper(String url, int port, org.slf4j.Logger logger)
  • Method Details

    • getHttpClientParams

      public String getHttpClientParams()
      Returns the configured HTTP client parameters and logs them.
      Returns:
      HTTP client parameters formatted as key=value pairs, separated by the system line separator
    • setLogging

      public ApiHelper setLogging(boolean enable)
    • setContentType

      public ApiHelper setContentType(io.restassured.http.ContentType contentType)
    • setMaxResponseMsAssert

      public ApiHelper setMaxResponseMsAssert(int maxResponseMs)
    • setTimeoutMs

      public ApiHelper setTimeoutMs(int maxTimeoutMs)
    • setBearerAuth

      public ApiHelper setBearerAuth(String token)
    • setBasicAuth

      public ApiHelper setBasicAuth(String username, String password)
    • setNoAuth

      public ApiHelper setNoAuth()
    • setHeaders

      public ApiHelper setHeaders(Map<String,Object> headers)
    • setHeader

      public ApiHelper setHeader(String key, Object value)
    • cleanSetHeaders

      public ApiHelper cleanSetHeaders()
    • withHeader

      public ApiHelper withHeader(String key, Object value)
    • withHeaders

      public ApiHelper withHeaders(Map<String,Object> headers)
    • setQueryParams

      public ApiHelper setQueryParams(Map<String,Object> queryParams)
    • cleanSetQueryParams

      public ApiHelper cleanSetQueryParams()
    • withQueryParam

      public ApiHelper withQueryParam(String key, Object value)
    • withQueryParams

      public ApiHelper withQueryParams(Map<String,Object> queryParams)
    • getLogging

      public Boolean getLogging()
    • getConfigSummary

      public String getConfigSummary(Class<?> clazz)
    • buildRequest

      public io.restassured.specification.RequestSpecification buildRequest()
    • buildSimpleRequest

      public io.restassured.specification.RequestSpecification buildSimpleRequest()