Interface HttpResponse
- All Superinterfaces:
HttpMessage
- All Known Subinterfaces:
HttpResponseReceived,InterceptedResponse
Burp HTTP response able to retrieve and modify details about an HTTP response.
-
Method Summary
Modifier and TypeMethodDescriptionattributes(AttributeType... types) Retrieve the values of response attributes.body()Body of a message as a byte array.intOffset within the message where the message body begins.Body of a message as aString.booleanSearches the data in the HTTP message for the specified search term.booleanSearches the data in the HTTP message for the specified regular expression.cookies()Obtain details of the HTTP cookies set in the response.cookieValue(String name) Create a copy of theHttpResponsein temporary file.
This method is used to save theHttpResponseobject to a temporary file, so that it is no longer held in memory.booleanbooleanbooleanhasHeader(HttpHeader header) booleanbooleanheaders()HTTP headers contained in the message.headerValue(String name) static HttpResponseCreate a new empty instance ofHttpResponse.static HttpResponsehttpResponse(ByteArray response) Create a new instance ofHttpResponse.static HttpResponsehttpResponse(String response) Create a new instance ofHttpResponse.HTTP Version text parsed from the request or response line for HTTP 1 messages.Obtain the MIME type of the response, as inferred from the contents of the HTTP message body.booleanisStatusCodeClass(StatusCodeClass statusCodeClass) Test whether the status code is in the specified class.keywordCounts(String... keywords) Retrieve the number of types given keywords appear in the response.markers()Markers for the message.mimeType()Obtain the MIME type of the response, as determined by Burp Suite.Obtain the HTTP reason phrase contained in the response for HTTP 1 messages.Obtain the MIME type of the response, as stated in the HTTP headers.shortObtain the HTTP status code contained in the response.Message as a byte array.toString()Message as aString.withAddedHeader(HttpHeader header) Create a copy of theHttpResponsewith the added header.withAddedHeader(String name, String value) Create a copy of theHttpResponsewith the added header.withAddedHeaders(HttpHeader... headers) Create a copy of theHttpResponsewith the added HTTP headers.withAddedHeaders(List<? extends HttpHeader> headers) Create a copy of theHttpResponsewith the added HTTP headers.Create a copy of theHttpResponsewith the updated body.
Updates Content-Length header.Create a copy of theHttpResponsewith the updated body.
Updates Content-Length header.withHttpVersion(String httpVersion) Create a copy of theHttpResponsewith the new http version.withMarkers(Marker... markers) Create a copy of theHttpResponsewith the added markers.withMarkers(List<Marker> markers) Create a copy of theHttpResponsewith the added markers.withReasonPhrase(String reasonPhrase) Create a copy of theHttpResponsewith the new reason phrase.withRemovedHeader(HttpHeader header) Create a copy of theHttpResponsewith the removed header.withRemovedHeader(String name) Create a copy of theHttpResponsewith the removed header.withRemovedHeaders(HttpHeader... headers) Create a copy of theHttpResponsewith the removed HTTP headers.withRemovedHeaders(List<? extends HttpHeader> headers) Create a copy of theHttpResponsewith the removed HTTP headers.withStatusCode(short statusCode) Create a copy of theHttpResponsewith the provided status code.withUpdatedHeader(HttpHeader header) Create a copy of theHttpResponsewith the updated header.withUpdatedHeader(String name, String value) Create a copy of theHttpResponsewith the updated header.withUpdatedHeaders(HttpHeader... headers) Create a copy of theHttpResponsewith the updated HTTP headers.withUpdatedHeaders(List<? extends HttpHeader> headers) Create a copy of theHttpResponsewith the updated HTTP headers.
-
Method Details
-
statusCode
short statusCode()Obtain the HTTP status code contained in the response.- Returns:
- HTTP status code.
-
reasonPhrase
String reasonPhrase()Obtain the HTTP reason phrase contained in the response for HTTP 1 messages. HTTP 2 messages will return a mapped phrase based on the status code.- Returns:
- HTTP Reason phrase.
-
isStatusCodeClass
Test whether the status code is in the specified class.- Parameters:
statusCodeClass- The class of status code to test.- Returns:
- True if the status code is in the class.
-
cookies
-
cookie
-
cookieValue
-
hasCookie
- Parameters:
name- The name of the cookie to check if it exists in the response.- Returns:
trueIf a cookie exists within the response that matches the name provided.falseif not.
-
hasCookie
-
mimeType
MimeType mimeType()Obtain the MIME type of the response, as determined by Burp Suite.- Returns:
- The MIME type.
-
statedMimeType
MimeType statedMimeType()Obtain the MIME type of the response, as stated in the HTTP headers.- Returns:
- The stated MIME type.
-
inferredMimeType
MimeType inferredMimeType()Obtain the MIME type of the response, as inferred from the contents of the HTTP message body.- Returns:
- The inferred MIME type.
-
keywordCounts
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
Retrieve the values of response attributes.- Parameters:
types- Response attributes to retrieve values for.- Returns:
- List of
Attributeobjects.
-
hasHeader
- Specified by:
hasHeaderin interfaceHttpMessage- Parameters:
header- The header to check if it exists in the request.- Returns:
- True if the header exists in the request.
-
hasHeader
- Specified by:
hasHeaderin interfaceHttpMessage- 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
- Specified by:
hasHeaderin interfaceHttpMessage- 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
- Specified by:
headerin interfaceHttpMessage- Parameters:
name- The name of the header to retrieve.- Returns:
- An instance of
HttpHeaderthat matches the name supplied,nullif no match found.
-
headerValue
- Specified by:
headerValuein interfaceHttpMessage- Parameters:
name- The name of the header to retrieve.- Returns:
- The
Stringvalue of the header that matches the name supplied,nullif no match found.
-
headers
List<HttpHeader> headers()HTTP headers contained in the message.- Specified by:
headersin interfaceHttpMessage- Returns:
- A list of HTTP headers.
-
httpVersion
String httpVersion()HTTP Version text parsed from the request or response line for HTTP 1 messages. HTTP 2 messages will return "HTTP/2"- Specified by:
httpVersionin interfaceHttpMessage- Returns:
- Version string
-
bodyOffset
int bodyOffset()Offset within the message where the message body begins.- Specified by:
bodyOffsetin interfaceHttpMessage- Returns:
- The message body offset.
-
body
ByteArray body()Body of a message as a byte array.- Specified by:
bodyin interfaceHttpMessage- Returns:
- The body of a message as a byte array.
-
bodyToString
String bodyToString()Body of a message as aString.- Specified by:
bodyToStringin interfaceHttpMessage- Returns:
- The body of a message as a
String.
-
markers
Markers for the message.- Specified by:
markersin interfaceHttpMessage- Returns:
- A list of markers.
-
contains
Searches the data in the HTTP message for the specified search term.- Specified by:
containsin interfaceHttpMessage- 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
Searches the data in the HTTP message for the specified regular expression.- Specified by:
containsin interfaceHttpMessage- 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:
toByteArrayin interfaceHttpMessage- Returns:
- The message as a byte array.
-
toString
String toString()Message as aString.- Specified by:
toStringin interfaceHttpMessage- Overrides:
toStringin classObject- Returns:
- The message as a
String.
-
copyToTempFile
HttpResponse copyToTempFile()Create a copy of theHttpResponsein temporary file.
This method is used to save theHttpResponseobject to a temporary file, so that it is no longer held in memory. Extensions can use this method to convertHttpResponseobjects into a form suitable for long-term usage.- Returns:
- A new
HttpResponseinstance stored in temporary file.
-
withStatusCode
Create a copy of theHttpResponsewith the provided status code.- Parameters:
statusCode- the new status code for response- Returns:
- A new
HttpResponseinstance.
-
withReasonPhrase
Create a copy of theHttpResponsewith the new reason phrase.- Parameters:
reasonPhrase- the new reason phrase for response- Returns:
- A new
HttpResponseinstance.
-
withHttpVersion
Create a copy of theHttpResponsewith the new http version.- Parameters:
httpVersion- the new http version for response- Returns:
- A new
HttpResponseinstance.
-
withBody
Create a copy of theHttpResponsewith the updated body.
Updates Content-Length header.- Parameters:
body- the new body for the response- Returns:
- A new
HttpResponseinstance.
-
withBody
Create a copy of theHttpResponsewith the updated body.
Updates Content-Length header.- Parameters:
body- the new body for the response- Returns:
- A new
HttpResponseinstance.
-
withAddedHeader
Create a copy of theHttpResponsewith the added header.- Parameters:
header- TheHttpHeaderto add to the response.- Returns:
- The updated response containing the added header.
-
withAddedHeader
Create a copy of theHttpResponsewith the added header.- Parameters:
name- The name of the header.value- The value of the header.- Returns:
- The updated response containing the added header.
-
withAddedHeaders
Create a copy of theHttpResponsewith the added HTTP headers.- Parameters:
headers- HTTP headers to add.- Returns:
- A new
HttpResponseinstance.
-
withAddedHeaders
Create a copy of theHttpResponsewith the added HTTP headers.- Parameters:
headers- HTTP headers to add.- Returns:
- A new
HttpResponseinstance.
-
withUpdatedHeader
Create a copy of theHttpResponsewith the updated header.- Parameters:
header- TheHttpHeaderto update containing the new value.- Returns:
- The updated response containing the updated header.
-
withUpdatedHeader
Create a copy of theHttpResponsewith 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 response containing the updated header.
-
withUpdatedHeaders
Create a copy of theHttpResponsewith the updated HTTP headers.- Parameters:
headers- HTTP headers to update.- Returns:
- A new
HttpResponseinstance.
-
withUpdatedHeaders
Create a copy of theHttpResponsewith the updated HTTP headers.- Parameters:
headers- HTTP headers to update.- Returns:
- A new
HttpResponseinstance.
-
withRemovedHeader
Create a copy of theHttpResponsewith the removed header.- Parameters:
header- TheHttpHeaderto remove from the response.- Returns:
- The updated response containing the removed header.
-
withRemovedHeader
Create a copy of theHttpResponsewith the removed header.- Parameters:
name- The name of the HTTP header to remove from the response.- Returns:
- The updated response containing the removed header.
-
withRemovedHeaders
Create a copy of theHttpResponsewith the removed HTTP headers.- Parameters:
headers- HTTP headers to remove.- Returns:
- A new
HttpResponseinstance.
-
withRemovedHeaders
Create a copy of theHttpResponsewith the removed HTTP headers.- Parameters:
headers- HTTP headers to remove.- Returns:
- A new
HttpResponseinstance.
-
withMarkers
Create a copy of theHttpResponsewith the added markers.- Parameters:
markers- Request markers to add.- Returns:
- A new
MarkedHttpRequestResponseinstance.
-
withMarkers
Create a copy of theHttpResponsewith the added markers.- Parameters:
markers- Request markers to add.- Returns:
- A new
MarkedHttpRequestResponseinstance.
-
httpResponse
Create a new empty instance ofHttpResponse.- Returns:
- A new
HttpResponseinstance.
-
httpResponse
Create a new instance ofHttpResponse.- Parameters:
response- The HTTP response.- Returns:
- A new
HttpResponseinstance.
-
httpResponse
Create a new instance ofHttpResponse.- Parameters:
response- The HTTP response.- Returns:
- A new
HttpResponseinstance.
-