Interface HttpRequestResponse


public interface HttpRequestResponse
This interface is used to define a coupling between HttpRequest and HttpResponse.
  • Method Details

    • request

      HttpRequest request()
      Returns:
      The HTTP request message.
    • response

      HttpResponse response()
      Returns:
      The HTTP response message.
    • httpService

      HttpService httpService()
      HTTP service for the request.
      Returns:
      An HttpService object containing details of the HTTP service.
    • annotations

      Annotations annotations()
      Returns:
      The annotations.
    • timingData

      Optional<TimingData> timingData()
      Retrieve the timing data associated with this request if available.
      Returns:
      The timing data.
    • url

      Deprecated, for removal: This API element is subject to removal in a future version.
      use request() url instead.
      Retrieve the URL for the request.
      If the request is malformed, then a MalformedRequestException is thrown.
      Returns:
      The URL in the request.
      Throws:
      MalformedRequestException - if request is malformed.
    • hasResponse

      boolean hasResponse()
      Returns:
      True if there is an HTTP response message.
    • contentType

      @Deprecated(forRemoval=true) ContentType contentType()
      Deprecated, for removal: This API element is subject to removal in a future version.
      use request() contentType instead.
      Returns:
      The detected content type of the request.
    • statusCode

      @Deprecated(forRemoval=true) short statusCode()
      Deprecated, for removal: This API element is subject to removal in a future version.
      use response() statusCode instead.
      HTTP status code contained in the response.
      Returns:
      HTTP status code or -1 if there is no response.
    • requestMarkers

      List<Marker> requestMarkers()
      Returns:
      List of request markers
    • responseMarkers

      List<Marker> responseMarkers()
      Returns:
      List of response markers
    • contains

      boolean contains(String searchTerm, boolean caseSensitive)
      Searches the data in the HTTP request, response and notes for the specified search term.
      Parameters:
      searchTerm - The value to be searched for.
      caseSensitive - Flags whether the search is case-sensitive.
      Returns:
      True if the search term is found.
    • contains

      boolean contains(Pattern pattern)
      Searches the data in the HTTP request, response and notes for the specified regular expression.
      Parameters:
      pattern - The regular expression to be searched for.
      Returns:
      True if the pattern is matched.
    • copyToTempFile

      HttpRequestResponse copyToTempFile()
      Create a copy of the HttpRequestResponse in temporary file.
      This method is used to save the HttpRequestResponse object to a temporary file, so that it is no longer held in memory. Extensions can use this method to convert HttpRequest objects into a form suitable for long-term usage.
      Returns:
      A new ByteArray instance stored in temporary file.
    • withAnnotations

      HttpRequestResponse withAnnotations(Annotations annotations)
      Create a copy of the HttpRequestResponse with the added annotations.
      Parameters:
      annotations - annotations to add.
      Returns:
      A new HttpRequestResponse instance.
    • withRequestMarkers

      HttpRequestResponse withRequestMarkers(List<Marker> requestMarkers)
      Create a copy of the HttpRequestResponse with the added request markers.
      Parameters:
      requestMarkers - Request markers to add.
      Returns:
      A new HttpRequestResponse instance.
    • withRequestMarkers

      HttpRequestResponse withRequestMarkers(Marker... requestMarkers)
      Create a copy of the HttpRequestResponse with the added request markers.
      Parameters:
      requestMarkers - Request markers to add.
      Returns:
      A new HttpRequestResponse instance.
    • withResponseMarkers

      HttpRequestResponse withResponseMarkers(List<Marker> responseMarkers)
      Create a copy of the HttpRequestResponse with the added response markers.
      Parameters:
      responseMarkers - Response markers to add.
      Returns:
      A new HttpRequestResponse instance.
    • withResponseMarkers

      HttpRequestResponse withResponseMarkers(Marker... responseMarkers)
      Create a copy of the HttpRequestResponse with the added response markers.
      Parameters:
      responseMarkers - Response markers to add.
      Returns:
      A new HttpRequestResponse instance.
    • httpRequestResponse

      static HttpRequestResponse httpRequestResponse(HttpRequest request, HttpResponse response)
      Create a new instance of HttpRequestResponse.
      Parameters:
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      A new HttpRequestResponse instance.
    • httpRequestResponse

      static HttpRequestResponse httpRequestResponse(HttpRequest httpRequest, HttpResponse httpResponse, Annotations annotations)
      Create a new instance of HttpRequestResponse.
      Parameters:
      httpRequest - The HTTP request.
      httpResponse - The HTTP response.
      annotations - annotations.
      Returns:
      A new HttpRequestResponse instance.