Interface HttpRequest

All Superinterfaces:
HttpMessage
All Known Subinterfaces:
HttpRequestToBeSent, InterceptedRequest

public interface HttpRequest extends HttpMessage
Burp HTTP request able to retrieve and modify details of an HTTP request.
  • Method Details

    • httpService

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

      String url()
      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.
    • method

      String method()
      HTTP method for the request. If the request is malformed, then a MalformedRequestException is thrown.
      Returns:
      The HTTP method used in the request.
      Throws:
      MalformedRequestException - if request is malformed.
    • path

      String path()
      Path and File for the request. If the request is malformed, then a MalformedRequestException is thrown.
      Returns:
      the path and file in the request
      Throws:
      MalformedRequestException - if request is malformed.
    • httpVersion

      String httpVersion()
      HTTP Version text parsed from the request line for HTTP 1 messages. HTTP 2 messages will return "HTTP/2"
      Specified by:
      httpVersion in interface HttpMessage
      Returns:
      Version string
    • headers

      List<HttpHeader> headers()
      HTTP headers contained in the message.
      Specified by:
      headers in interface HttpMessage
      Returns:
      A list of HTTP headers.
    • contentType

      ContentType contentType()
      Returns:
      The detected content type of the request.
    • parameters

      List<ParsedHttpParameter> parameters()
      Returns:
      The parameters contained in the request.
    • body

      ByteArray body()
      Body of a message as a byte array.
      Specified by:
      body in interface HttpMessage
      Returns:
      The body of a message as a byte array.
    • bodyToString

      String bodyToString()
      Body of a message as a String.
      Specified by:
      bodyToString in interface HttpMessage
      Returns:
      The body of a message as a String.
    • bodyOffset

      int bodyOffset()
      Offset within the message where the message body begins.
      Specified by:
      bodyOffset in interface HttpMessage
      Returns:
      The message body offset.
    • markers

      List<Marker> markers()
      Markers for the message.
      Specified by:
      markers in interface HttpMessage
      Returns:
      A list of markers.
    • toByteArray

      ByteArray toByteArray()
      Message as a byte array.
      Specified by:
      toByteArray in interface HttpMessage
      Returns:
      The message as a byte array.
    • toString

      String toString()
      Message as a String.
      Specified by:
      toString in interface HttpMessage
      Overrides:
      toString in class Object
      Returns:
      The message as a String.
    • copyToTempFile

      HttpRequest copyToTempFile()
      Create a copy of the HttpRequest in temporary file.
      This method is used to save the HttpRequest 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 HttpRequest instance stored in temporary file.
    • withService

      HttpRequest withService(HttpService service)
      Create a copy of the HttpRequest with the new service.
      Parameters:
      service - An HttpService reference to add.
      Returns:
      A new HttpRequest instance.
    • withPath

      HttpRequest withPath(String path)
      Create a copy of the HttpRequest with the new path.
      Parameters:
      path - The path to use.
      Returns:
      A new HttpRequest instance with updated path.
    • withMethod

      HttpRequest withMethod(String method)
      Create a copy of the HttpRequest with the new method.
      Parameters:
      method - the method to use
      Returns:
      a new HttpRequest instance with updated method.
    • withHeader

      HttpRequest withHeader(HttpHeader header)
      Create a copy of the HttpRequest with the added or updated header.
      If the header exists in the request, it is updated.
      If the header doesn't exist in the request, it is added.
      Parameters:
      header - HTTP header to add or update.
      Returns:
      A new HttpRequest with the added or updated header.
    • withHeader

      HttpRequest withHeader(String name, String value)
      Create a copy of the HttpRequest with the added or updated header.
      If the header exists in the request, it is updated.
      If the header doesn't exist in the request, it is added.
      Parameters:
      name - The name of the header.
      value - The value of the header.
      Returns:
      A new HttpRequest with the added or updated header.
    • withParameter

      HttpRequest withParameter(HttpParameter parameters)
      Create a copy of the HttpRequest with the HTTP parameter.
      If the parameter exists in the request, it is updated.
      If the parameter doesn't exist in the request, it is added.
      Parameters:
      parameters - HTTP parameter to add or update.
      Returns:
      A new HttpRequest with the added or updated parameter.
    • withAddedParameters

      HttpRequest withAddedParameters(List<HttpParameter> parameters)
      Create a copy of the HttpRequest with the added HTTP parameters.
      Parameters:
      parameters - HTTP parameters to add.
      Returns:
      A new HttpRequest instance.
    • withAddedParameters

      HttpRequest withAddedParameters(HttpParameter... parameters)
      Create a copy of the HttpRequest with the added HTTP parameters.
      Parameters:
      parameters - HTTP parameters to add.
      Returns:
      A new HttpRequest instance.
    • withRemovedParameters

      HttpRequest withRemovedParameters(List<HttpParameter> parameters)
      Create a copy of the HttpRequest with the removed HTTP parameters.
      Parameters:
      parameters - HTTP parameters to remove.
      Returns:
      A new HttpRequest instance.
    • withRemovedParameters

      HttpRequest withRemovedParameters(HttpParameter... parameters)
      Create a copy of the HttpRequest with the removed HTTP parameters.
      Parameters:
      parameters - HTTP parameters to remove.
      Returns:
      A new HttpRequest instance.
    • withUpdatedParameters

      HttpRequest withUpdatedParameters(List<HttpParameter> parameters)
      Create a copy of the HttpRequest with the updated HTTP parameters.
      Parameters:
      parameters - HTTP parameters to update.
      Returns:
      A new HttpRequest instance.
    • withUpdatedParameters

      HttpRequest withUpdatedParameters(HttpParameter... parameters)
      Create a copy of the HttpRequest with the updated HTTP parameters.
      Parameters:
      parameters - HTTP parameters to update.
      Returns:
      A new HttpRequest instance.
    • withTransformationApplied

      HttpRequest withTransformationApplied(HttpTransformation transformation)
      Create a copy of the HttpRequest with the transformation applied.
      Parameters:
      transformation - Transformation to apply.
      Returns:
      A new HttpRequest instance.
    • withBody

      HttpRequest withBody(String body)
      Create a copy of the HttpRequest with the updated body.
      Updates Content-Length header.
      Parameters:
      body - the new body for the request
      Returns:
      A new HttpRequest instance.
    • withBody

      HttpRequest withBody(ByteArray body)
      Create a copy of the HttpRequest with the updated body.
      Updates Content-Length header.
      Parameters:
      body - the new body for the request
      Returns:
      A new HttpRequest instance.
    • withAddedHeader

      HttpRequest withAddedHeader(String name, String value)
      Create a copy of the HttpRequest with the added header.
      Parameters:
      name - The name of the header.
      value - The value of the header.
      Returns:
      The updated HTTP request with the added header.
    • withAddedHeader

      HttpRequest withAddedHeader(HttpHeader header)
      Create a copy of the HttpRequest with the added header.
      Parameters:
      header - The HttpHeader to add to the HTTP request.
      Returns:
      The updated HTTP request with the added header.
    • withUpdatedHeader

      HttpRequest withUpdatedHeader(String name, String value)
      Create a copy of the HttpRequest with the updated header.
      Parameters:
      name - The name of the header to update the value of.
      value - The new value of the specified HTTP header.
      Returns:
      The updated request containing the updated header.
    • withUpdatedHeader

      HttpRequest withUpdatedHeader(HttpHeader header)
      Create a copy of the HttpRequest with the updated header.
      Parameters:
      header - The HttpHeader to update containing the new value.
      Returns:
      The updated request containing the updated header.
    • withRemovedHeader

      HttpRequest withRemovedHeader(String name)
      Removes an existing HTTP header from the current request.
      Parameters:
      name - The name of the HTTP header to remove from the request.
      Returns:
      The updated request containing the removed header.
    • withRemovedHeader

      HttpRequest withRemovedHeader(HttpHeader header)
      Removes an existing HTTP header from the current request.
      Parameters:
      header - The HttpHeader to remove from the request.
      Returns:
      The updated request containing the removed header.
    • withMarkers

      HttpRequest withMarkers(List<Marker> markers)
      Create a copy of the HttpRequest with the added markers.
      Parameters:
      markers - Request markers to add.
      Returns:
      A new MarkedHttpRequestResponse instance.
    • withMarkers

      HttpRequest withMarkers(Marker... markers)
      Create a copy of the HttpRequest with the added markers.
      Parameters:
      markers - Request markers to add.
      Returns:
      A new MarkedHttpRequestResponse instance.
    • withDefaultHeaders

      HttpRequest withDefaultHeaders()
      Create a copy of the HttpRequest with added default headers.
      Returns:
      a new (@code HttpRequest) with added default headers
    • httpRequest

      static HttpRequest httpRequest()
      Create a new empty instance of HttpRequest.
      Returns:
      A new HttpRequest instance.
    • httpRequest

      static HttpRequest httpRequest(ByteArray request)
      Create a new instance of HttpRequest.
      Parameters:
      request - The HTTP request
      Returns:
      A new HttpRequest instance.
    • httpRequest

      static HttpRequest httpRequest(String request)
      Create a new instance of HttpRequest.
      Parameters:
      request - The HTTP request.
      Returns:
      A new HttpRequest instance.
    • httpRequest

      static HttpRequest httpRequest(HttpService service, ByteArray request)
      Create a new instance of HttpRequest.
      Parameters:
      service - An HTTP service for the request.
      request - The HTTP request.
      Returns:
      A new HttpRequest instance. A new HttpRequest instance.
    • httpRequest

      static HttpRequest httpRequest(HttpService service, String request)
      Create a new instance of HttpRequest.
      Parameters:
      service - An HTTP service for the request.
      request - The HTTP request.
      Returns:
      A new HttpRequest instance.
    • httpRequestFromUrl

      static HttpRequest httpRequestFromUrl(String url)
      Create a new instance of HttpRequest.
      Parameters:
      url - A URL for the request.
      Returns:
      A new HttpRequest instance.
    • http2Request

      static HttpRequest http2Request(HttpService service, List<HttpHeader> headers, ByteArray body)
      Create a new instance of HttpRequest containing HTTP 2 headers and body.
      Parameters:
      service - An HTTP service for the request.
      headers - A list of HTTP 2 headers.
      body - A body of the HTTP 2 request.
      Returns:
      A new HttpRequest instance.
    • http2Request

      static HttpRequest http2Request(HttpService service, List<HttpHeader> headers, String body)
      Create a new instance of HttpRequest containing HTTP 2 headers and body.
      Parameters:
      service - An HTTP service for the request.
      headers - A list of HTTP 2 headers.
      body - A body of the HTTP 2 request.
      Returns:
      A new HttpRequest instance.