Interface HttpRequestToBeSent

All Superinterfaces:
HttpMessage, HttpRequest

public interface HttpRequestToBeSent extends HttpRequest
Burp HttpRequest with additional methods to retrieve Annotations and ToolSource of the request.
  • Method Details

    • messageId

      int messageId()
      Returns:
      The ID for this request to be sent. The corresponding response will have an identical ID.
    • annotations

      Annotations annotations()
      Returns:
      annotations for request/response
    • toolSource

      ToolSource toolSource()
      Returns:
      Indicates which Burp tool sent the request.
    • isInScope

      boolean isInScope()
      Specified by:
      isInScope in interface HttpRequest
      Returns:
      True if the request is in-scope.
    • httpService

      HttpService httpService()
      HTTP service for the request.
      Specified by:
      httpService in interface HttpRequest
      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.
      Specified by:
      url in interface HttpRequest
      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.
      Specified by:
      method in interface HttpRequest
      Returns:
      The HTTP method used in the request.
      Throws:
      MalformedRequestException - if request is malformed.
    • path

      String path()
      Request path including the query parameters. If the request is malformed, then a MalformedRequestException is thrown.
      Specified by:
      path in interface HttpRequest
      Returns:
      the path and query parameters.
      Throws:
      MalformedRequestException - if request is malformed.
    • pathWithoutQuery

      String pathWithoutQuery()
      Request path excluding the query parameters. If the request is malformed, then a MalformedRequestException is thrown.
      Specified by:
      pathWithoutQuery in interface HttpRequest
      Returns:
      the path excluding query parameters.
      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
      Specified by:
      httpVersion in interface HttpRequest
      Returns:
      Version string
    • headers

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

      boolean hasHeader(HttpHeader header)
      Specified by:
      hasHeader in interface HttpMessage
      Specified by:
      hasHeader in interface HttpRequest
      Parameters:
      header - The header to check if it exists in the request.
      Returns:
      True if the header exists in the request.
    • hasHeader

      boolean hasHeader(String name)
      Specified by:
      hasHeader in interface HttpMessage
      Specified by:
      hasHeader in interface HttpRequest
      Parameters:
      name - The name of the header to query within the request.
      Returns:
      True if a header exists in the request with the supplied name.
    • hasHeader

      boolean hasHeader(String name, String value)
      Specified by:
      hasHeader in interface HttpMessage
      Specified by:
      hasHeader in interface HttpRequest
      Parameters:
      name - The name of the header to check.
      value - The value of the header to check.
      Returns:
      True if a header exists in the request that matches the name and value supplied.
    • header

      HttpHeader header(String name)
      Specified by:
      header in interface HttpMessage
      Specified by:
      header in interface HttpRequest
      Parameters:
      name - The name of the header to retrieve.
      Returns:
      An instance of HttpHeader that matches the name supplied, null if no match found.
    • headerValue

      String headerValue(String name)
      Specified by:
      headerValue in interface HttpMessage
      Specified by:
      headerValue in interface HttpRequest
      Parameters:
      name - The name of the header to retrieve.
      Returns:
      The String value of the header that matches the name supplied, null if no match found.
    • hasParameters

      boolean hasParameters()
      Specified by:
      hasParameters in interface HttpRequest
      Returns:
      True if the request has parameters.
    • hasParameters

      boolean hasParameters(HttpParameterType type)
      Specified by:
      hasParameters in interface HttpRequest
      Returns:
      True if the request has parameters of type HttpParameterType
    • parameter

      Specified by:
      parameter in interface HttpRequest
      Parameters:
      name - The name of the parameter to find.
      type - The type of the parameter to find.
      Returns:
      An instance of ParsedHttpParameter that matches the type and name specified. null if not found.
    • parameterValue

      String parameterValue(String name, HttpParameterType type)
      Specified by:
      parameterValue in interface HttpRequest
      Parameters:
      name - The name of the parameter to get the value from.
      type - The type of the parameter to get the value from.
      Returns:
      The value of the parameter that matches the name and type specified. null if not found.
    • hasParameter

      boolean hasParameter(String name, HttpParameterType type)
      Specified by:
      hasParameter in interface HttpRequest
      Parameters:
      name - The name of the parameter to find.
      type - The type of the parameter to find.
      Returns:
      true if a parameter exists that matches the name and type specified. false if not found.
    • hasParameter

      boolean hasParameter(HttpParameter parameter)
      Specified by:
      hasParameter in interface HttpRequest
      Parameters:
      parameter - An instance of HttpParameter to match to an existing parameter.
      Returns:
      true if a parameter exists that matches the data within the provided HttpParameter. false if not found.
    • contentType

      ContentType contentType()
      Specified by:
      contentType in interface HttpRequest
      Returns:
      The detected content type of the request.
    • parameters

      List<ParsedHttpParameter> parameters()
      Specified by:
      parameters in interface HttpRequest
      Returns:
      The parameters contained in the request.
    • parameters

      Specified by:
      parameters in interface HttpRequest
      Parameters:
      type - The type of parameter that will be returned in the filtered list.
      Returns:
      A filtered list of ParsedHttpParameter containing only the provided type.
    • body

      ByteArray body()
      Body of a message as a byte array.
      Specified by:
      body in interface HttpMessage
      Specified by:
      body in interface HttpRequest
      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
      Specified by:
      bodyToString in interface HttpRequest
      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
      Specified by:
      bodyOffset in interface HttpRequest
      Returns:
      The message body offset.
    • markers

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

      boolean contains(String searchTerm, boolean caseSensitive)
      Searches the data in the HTTP message for the specified search term.
      Specified by:
      contains in interface HttpMessage
      Specified by:
      contains in interface HttpRequest
      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 message for the specified regular expression.
      Specified by:
      contains in interface HttpMessage
      Specified by:
      contains in interface HttpRequest
      Parameters:
      pattern - The regular expression to be searched for.
      Returns:
      True if the pattern is matched.
    • toByteArray

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

      String toString()
      Message as a String.
      Specified by:
      toString in interface HttpMessage
      Specified by:
      toString in interface HttpRequest
      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.
      Specified by:
      copyToTempFile in interface HttpRequest
      Returns:
      A new HttpRequest instance stored in temporary file.
    • withService

      HttpRequest withService(HttpService service)
      Create a copy of the HttpRequest with the new service.
      Specified by:
      withService in interface HttpRequest
      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.
      Specified by:
      withPath in interface HttpRequest
      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.
      Specified by:
      withMethod in interface HttpRequest
      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.
      Specified by:
      withHeader in interface HttpRequest
      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.
      Specified by:
      withHeader in interface HttpRequest
      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.
      Specified by:
      withParameter in interface HttpRequest
      Parameters:
      parameters - HTTP parameter to add or update.
      Returns:
      A new HttpRequest with the added or updated parameter.
    • withAddedParameters

      HttpRequest withAddedParameters(List<? extends HttpParameter> parameters)
      Create a copy of the HttpRequest with the added HTTP parameters.
      Specified by:
      withAddedParameters in interface HttpRequest
      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.
      Specified by:
      withAddedParameters in interface HttpRequest
      Parameters:
      parameters - HTTP parameters to add.
      Returns:
      A new HttpRequest instance.
    • withRemovedParameters

      HttpRequest withRemovedParameters(List<? extends HttpParameter> parameters)
      Create a copy of the HttpRequest with the removed HTTP parameters.
      Specified by:
      withRemovedParameters in interface HttpRequest
      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.
      Specified by:
      withRemovedParameters in interface HttpRequest
      Parameters:
      parameters - HTTP parameters to remove.
      Returns:
      A new HttpRequest instance.
    • withUpdatedParameters

      HttpRequest withUpdatedParameters(List<? extends HttpParameter> parameters)
      Create a copy of the HttpRequest with the updated HTTP parameters.
      Specified by:
      withUpdatedParameters in interface HttpRequest
      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.
      Specified by:
      withUpdatedParameters in interface HttpRequest
      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.
      Specified by:
      withTransformationApplied in interface HttpRequest
      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.
      Specified by:
      withBody in interface HttpRequest
      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.
      Specified by:
      withBody in interface HttpRequest
      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.
      Specified by:
      withAddedHeader in interface HttpRequest
      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.
      Specified by:
      withAddedHeader in interface HttpRequest
      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.
      Specified by:
      withUpdatedHeader in interface HttpRequest
      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.
      Specified by:
      withUpdatedHeader in interface HttpRequest
      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.
      Specified by:
      withRemovedHeader in interface HttpRequest
      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.
      Specified by:
      withRemovedHeader in interface HttpRequest
      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.
      Specified by:
      withMarkers in interface HttpRequest
      Parameters:
      markers - Request markers to add.
      Returns:
      A new HttpRequest instance.
    • withMarkers

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

      HttpRequest withDefaultHeaders()
      Create a copy of the HttpRequest with added default headers.
      Specified by:
      withDefaultHeaders in interface HttpRequest
      Returns:
      a new HttpRequest with added default headers