Interface HttpRequest
-
- All Superinterfaces:
HttpMessage
- All Known Subinterfaces:
InterceptedHttpRequest
public interface HttpRequest extends HttpMessage
This interface is used to retrieve key details about an HTTP request.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description HttpRequestaddHeader(HttpHeader header)Adds an HTTP header to the current request.HttpRequestaddHeader(java.lang.String name, java.lang.String value)Adds an HTTP header to the current request.ContentTypecontentType()static HttpRequesthttpRequest(ByteArray request)This is a helper method to create a new instance ofHttpRequest.static HttpRequesthttpRequest(HttpService service, ByteArray request)This is a helper method to create a new instance ofHttpRequest.static HttpRequesthttpRequest(HttpService service, java.lang.String request)This is a helper method to create a new instance ofHttpRequest.static HttpRequesthttpRequest(HttpService service, java.util.List<java.lang.String> headers, ByteArray body)This is a helper method to create a new instance ofHttpRequest.static HttpRequesthttpRequest(HttpService service, java.util.List<java.lang.String> headers, java.lang.String body)This is a helper method to create a new instance ofHttpRequest.static HttpRequesthttpRequest(java.lang.String request)This is a helper method to create a new instance ofHttpRequest.static HttpRequesthttpRequestFromUrl(java.lang.String url)This is a helper method to create a new instance ofHttpRequest.HttpServicehttpService()This method is used to retrieve the HTTP service for the request.static HttpRequesthttpVerbatimRequest(HttpService service, java.util.List<HttpHeader> headers, ByteArray body)This is a helper method to create a new instance ofHttpRequestthat will only contain the data provided in the arguments.static HttpRequesthttpVerbatimRequest(HttpService service, java.util.List<HttpHeader> headers, java.lang.String body)This is a helper method to create a new instance ofHttpRequestthat will only contain the data provided in the arguments.java.lang.Stringmethod()java.util.List<ParsedHttpParameter>parameters()HttpRequestremoveHeader(HttpHeader header)Removes an existing HTTP header from the current request.HttpRequestremoveHeader(java.lang.String name)Removes an existing HTTP header from the current request.HttpRequestupdateHeader(HttpHeader header)Updates an existing HTTP header in the request with a new value.HttpRequestupdateHeader(java.lang.String name, java.lang.String value)Updates an existing HTTP header in the request with a new value.java.lang.Stringurl()HttpRequestwithAddedParameters(HttpParameter... parameters)This is a helper method that builds a modified request with the added HTTP parameters.HttpRequestwithAddedParameters(java.util.List<HttpParameter> parameters)This is a helper method that builds a modified request with the added HTTP parameters.HttpRequestwithBody(ByteArray body)This is a helper method that builds a modified request with the updated body.HttpRequestwithBody(java.lang.String body)This is a helper method that builds a modified request with the updated body.HttpRequestwithPath(java.lang.String path)This is a helper method that builds a modified request with the new path.HttpRequestwithRemovedParameters(HttpParameter... parameters)This is a helper method that builds a modified request with the removed HTTP parameters.HttpRequestwithRemovedParameters(java.util.List<HttpParameter> parameters)This is a helper method that builds a modified request with the removed HTTP parameters.HttpRequestwithService(HttpService service)This is a helper method that builds a modified request with the new service.HttpRequestwithTransformationApplied(HttpTransformation transformation)This is a helper method that builds a modified request with the transformation applied.HttpRequestwithUpdatedParameters(HttpParameter... parameters)This is a helper method that builds a modified request with the updated HTTP parameters.HttpRequestwithUpdatedParameters(java.util.List<HttpParameter> parameters)This is a helper method that builds a modified request with the updated HTTP parameters.-
Methods inherited from interface burp.api.montoya.http.message.HttpMessage
asBytes, body, bodyAsString, bodyOffset, headers, toString
-
-
-
-
Method Detail
-
httpRequest
static HttpRequest httpRequest(ByteArray request)
This is a helper method to create a new instance ofHttpRequest.- Parameters:
request- The HTTP request- Returns:
- A new
HttpRequestinstance.
-
httpRequest
static HttpRequest httpRequest(java.lang.String request)
This is a helper method to create a new instance ofHttpRequest.- Parameters:
request- The HTTP request.- Returns:
- A new
HttpRequestinstance.
-
httpRequest
static HttpRequest httpRequest(HttpService service, ByteArray request)
This is a helper method to create a new instance ofHttpRequest.- Parameters:
service- An HTTP service for the request.request- The HTTP request.- Returns:
- A new
HttpRequestinstance. A newHttpRequestinstance.
-
httpRequest
static HttpRequest httpRequest(HttpService service, java.lang.String request)
This is a helper method to create a new instance ofHttpRequest.- Parameters:
service- An HTTP service for the request.request- The HTTP request.- Returns:
- A new
HttpRequestinstance.
-
httpRequest
static HttpRequest httpRequest(HttpService service, java.util.List<java.lang.String> headers, ByteArray body)
This is a helper method to create a new instance ofHttpRequest.- Parameters:
service- An HTTP service for the request.headers- A list of HTTP headers.body- A body of the HTTP request.- Returns:
- A new
HttpRequestinstance.
-
httpRequest
static HttpRequest httpRequest(HttpService service, java.util.List<java.lang.String> headers, java.lang.String body)
This is a helper method to create a new instance ofHttpRequest.- Parameters:
service- An HTTP service for the request.headers- A list of HTTP headers.body- A body of the HTTP request.- Returns:
- A new
HttpRequestinstance.
-
httpVerbatimRequest
static HttpRequest httpVerbatimRequest(HttpService service, java.util.List<HttpHeader> headers, ByteArray body)
This is a helper method to create a new instance ofHttpRequestthat will only contain the data provided in the arguments.- Parameters:
service- An HTTP service for the request.headers- A list of HTTP headers.body- A body of the HTTP request.- Returns:
- A new
HttpRequestinstance.
-
httpVerbatimRequest
static HttpRequest httpVerbatimRequest(HttpService service, java.util.List<HttpHeader> headers, java.lang.String body)
This is a helper method to create a new instance ofHttpRequestthat will only contain the data provided in the arguments.- Parameters:
service- An HTTP service for the request.headers- A list of HTTP headers.body- A body of the HTTP request.- Returns:
- A new
HttpRequestinstance.
-
httpRequestFromUrl
static HttpRequest httpRequestFromUrl(java.lang.String url)
This is a helper method to create a new instance ofHttpRequest.- Parameters:
url- A URL for the request.- Returns:
- A new
HttpRequestinstance.
-
httpService
HttpService httpService()
This method is used to retrieve the HTTP service for the request.- Returns:
- An
HttpServiceobject containing details of the HTTP service.
-
method
java.lang.String method()
- Returns:
- The HTTP method used in the request.
-
url
java.lang.String url()
- Returns:
- The URL in the request.
-
contentType
ContentType contentType()
- Returns:
- The content type of the message body.
-
parameters
java.util.List<ParsedHttpParameter> parameters()
- Returns:
- The parameters contained in the request.
-
withService
HttpRequest withService(HttpService service)
This is a helper method that builds a modified request with the new service.- Parameters:
service- AnHttpServicereference to add.- Returns:
- A new
HttpRequestinstance.
-
withPath
HttpRequest withPath(java.lang.String path)
This is a helper method that builds a modified request with the new path.- Parameters:
path- The path to use.- Returns:
- A new
HttpRequestinstance with updated path.
-
withAddedParameters
HttpRequest withAddedParameters(java.util.List<HttpParameter> parameters)
This is a helper method that builds a modified request with the added HTTP parameters.- Parameters:
parameters- HTTP parameters to add.- Returns:
- A new
HttpRequestinstance.
-
withAddedParameters
HttpRequest withAddedParameters(HttpParameter... parameters)
This is a helper method that builds a modified request with the added HTTP parameters.- Parameters:
parameters- HTTP parameters to add.- Returns:
- A new
HttpRequestinstance.
-
withRemovedParameters
HttpRequest withRemovedParameters(java.util.List<HttpParameter> parameters)
This is a helper method that builds a modified request with the removed HTTP parameters.- Parameters:
parameters- HTTP parameters to remove.- Returns:
- A new
HttpRequestinstance.
-
withRemovedParameters
HttpRequest withRemovedParameters(HttpParameter... parameters)
This is a helper method that builds a modified request with the removed HTTP parameters.- Parameters:
parameters- HTTP parameters to remove.- Returns:
- A new
HttpRequestinstance.
-
withUpdatedParameters
HttpRequest withUpdatedParameters(java.util.List<HttpParameter> parameters)
This is a helper method that builds a modified request with the updated HTTP parameters. If a parameter does not exist in the request, a new one will be added.- Parameters:
parameters- HTTP parameters to update.- Returns:
- A new
HttpRequestinstance.
-
withUpdatedParameters
HttpRequest withUpdatedParameters(HttpParameter... parameters)
This is a helper method that builds a modified request with the updated HTTP parameters. If a parameter does not exist in the request, a new one will be added.- Parameters:
parameters- HTTP parameters to update.- Returns:
- A new
HttpRequestinstance.
-
withTransformationApplied
HttpRequest withTransformationApplied(HttpTransformation transformation)
This is a helper method that builds a modified request with the transformation applied.- Parameters:
transformation- Transformation to apply.- Returns:
- A new
HttpRequestinstance.
-
withBody
HttpRequest withBody(java.lang.String body)
This is a helper method that builds a modified request with the updated body. Updates Content-Length header.- Parameters:
body- the new body for the request- Returns:
- A new
HttpRequestinstance.
-
withBody
HttpRequest withBody(ByteArray body)
This is a helper method that builds a modified request with the updated body. Updates Content-Length header.- Parameters:
body- the new body for the request- Returns:
- A new
HttpRequestinstance.
-
addHeader
HttpRequest addHeader(java.lang.String name, java.lang.String value)
Adds an HTTP header to the current request.- Parameters:
name- The name of the header.value- The value of the header.- Returns:
- The updated HTTP request with the added header.
-
addHeader
HttpRequest addHeader(HttpHeader header)
Adds an HTTP header to the current request.- Parameters:
header- TheHttpHeaderto add to the HTTP request.- Returns:
- The updated HTTP request with the added header.
-
updateHeader
HttpRequest updateHeader(java.lang.String name, java.lang.String value)
Updates an existing HTTP header in the request with a new value.- 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.
-
updateHeader
HttpRequest updateHeader(HttpHeader header)
Updates an existing HTTP header in the request with a new value.- Parameters:
header- TheHttpHeaderto update containing the new value.- Returns:
- The updated request containing the updated header.
-
removeHeader
HttpRequest removeHeader(java.lang.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.
-
removeHeader
HttpRequest removeHeader(HttpHeader header)
Removes an existing HTTP header from the current request.- Parameters:
header- TheHttpHeaderto remove from the request.- Returns:
- The updated request containing the removed header.
-
-