Interface HttpResponse
-
- All Superinterfaces:
HttpMessage
- All Known Subinterfaces:
InterceptedHttpResponse
public interface HttpResponse extends HttpMessage
This interface is used to retrieve key details about an HTTP response.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description HttpResponseaddHeader(HttpHeader header)Adds an HTTP header to the response.HttpResponseaddHeader(java.lang.String name, java.lang.String value)Adds an HTTP header to the response.java.util.List<Attribute>attributes(AttributeType... types)This method is used to retrieve the values of response attributes.java.util.List<Cookie>cookies()This method is used to obtain details of the HTTP cookies set in the response.static HttpResponsehttpResponse(ByteArray response)This is a helper method to create a new instance ofHttpResponse.static HttpResponsehttpResponse(java.lang.String response)This is a helper method to create a new instance ofHttpResponse.static HttpResponsehttpResponse(java.util.List<java.lang.String> headers, ByteArray body)This is a helper method to create a new instance ofHttpResponse.static HttpResponsehttpResponse(java.util.List<java.lang.String> headers, java.lang.String body)This is a helper method to create a new instance ofHttpResponse.MimeTypeinferredMimeType()This method is used to obtain the MIME type of the response, as inferred from the contents of the HTTP message body.java.util.List<KeywordCount>keywordCounts(java.lang.String... keywords)This method is used to retrieve the number of types given keywords appear in the response.HttpResponseremoveHeader(HttpHeader header)Removes an existing HTTP header from the current response.HttpResponseremoveHeader(java.lang.String name)Removes an existing HTTP header from the current response.MimeTypestatedMimeType()This method is used to obtain the MIME type of the response, as stated in the HTTP headers.shortstatusCode()This method is used to obtain the HTTP status code contained in the response.HttpResponseupdateHeader(HttpHeader header)Updates an existing HTTP header in the response with a new value.HttpResponseupdateHeader(java.lang.String name, java.lang.String value)Updates an existing HTTP header in the response with a new value.HttpResponsewithBody(ByteArray body)This is a helper method that builds a modified response with the updated body.HttpResponsewithBody(java.lang.String body)This is a helper method that builds a modified response with the updated body.-
Methods inherited from interface burp.api.montoya.http.message.HttpMessage
asBytes, body, bodyAsString, bodyOffset, headers, toString
-
-
-
-
Method Detail
-
httpResponse
static HttpResponse httpResponse(ByteArray response)
This is a helper method to create a new instance ofHttpResponse.- Parameters:
response- The HTTP response.- Returns:
- A new
HttpResponseinstance.
-
httpResponse
static HttpResponse httpResponse(java.lang.String response)
This is a helper method to create a new instance ofHttpResponse.- Parameters:
response- The HTTP response.- Returns:
- A new
HttpResponseinstance.
-
httpResponse
static HttpResponse httpResponse(java.util.List<java.lang.String> headers, ByteArray body)
This is a helper method to create a new instance ofHttpResponse.- Parameters:
headers- A list of HTTP headers.body- An HTTP response body.- Returns:
- A new
HttpResponseinstance.
-
httpResponse
static HttpResponse httpResponse(java.util.List<java.lang.String> headers, java.lang.String body)
This is a helper method to create a new instance ofHttpResponse.- Parameters:
headers- A list of HTTP headers.body- An HTTP response body.- Returns:
- A new
HttpResponseinstance.
-
statusCode
short statusCode()
This method is used to obtain the HTTP status code contained in the response.- Returns:
- HTTP status code.
-
cookies
java.util.List<Cookie> cookies()
This method is used to obtain details of the HTTP cookies set in the response.- Returns:
- A list of
Cookieobjects representing the cookies set in the response, if any.
-
statedMimeType
MimeType statedMimeType()
This method is used to obtain the MIME type of the response, as stated in the HTTP headers.- Returns:
- The stated MIME type.
-
inferredMimeType
MimeType inferredMimeType()
This method is used to obtain the MIME type of the response, as inferred from the contents of the HTTP message body.- Returns:
- The inferred MIME type.
-
keywordCounts
java.util.List<KeywordCount> keywordCounts(java.lang.String... keywords)
This method is used to retrieve the number of types given keywords appear in the response.- Parameters:
keywords- Keywords to count.- Returns:
- List of keyword counts in the order they were provided.
-
attributes
java.util.List<Attribute> attributes(AttributeType... types)
This method is used to retrieve the values of response attributes.- Parameters:
types- Response attributes to retrieve values for.- Returns:
- List of
Attributeobjects.
-
withBody
HttpResponse withBody(java.lang.String body)
This is a helper method that builds a modified response with the updated body. Updates Content-Length header.- Parameters:
body- the new body for the response- Returns:
- A new
HttpResponseinstance.
-
withBody
HttpResponse withBody(ByteArray body)
This is a helper method that builds a modified response with the updated body. Updates Content-Length header.- Parameters:
body- the new body for the response- Returns:
- A new
HttpResponseinstance.
-
addHeader
HttpResponse addHeader(HttpHeader header)
Adds an HTTP header to the response.- Parameters:
header- TheHttpHeaderto add to the response.- Returns:
- The updated response containing the added header.
-
addHeader
HttpResponse addHeader(java.lang.String name, java.lang.String value)
Adds an HTTP header to the response.- Parameters:
name- The name of the header.value- The value of the header.- Returns:
- The updated response containing the added header.
-
updateHeader
HttpResponse updateHeader(HttpHeader header)
Updates an existing HTTP header in the response with a new value.- Parameters:
header- TheHttpHeaderto update containing the new value.- Returns:
- The updated response containing the updated header.
-
updateHeader
HttpResponse updateHeader(java.lang.String name, java.lang.String value)
Updates an existing HTTP header in the response 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 response containing the updated header.
-
removeHeader
HttpResponse removeHeader(HttpHeader header)
Removes an existing HTTP header from the current response.- Parameters:
header- TheHttpHeaderto remove from the response.- Returns:
- The updated response containing the removed header.
-
removeHeader
HttpResponse removeHeader(java.lang.String name)
Removes an existing HTTP header from the current response.- Parameters:
name- The name of the HTTP header to remove from the response.- Returns:
- The updated response containing the removed header.
-
-