Package com.microsoft.playwright
Interface Response
-
public interface ResponseResponseclass represents responses which are received by page.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<String,String>allHeaders()An object with all the response HTTP headers associated with this response.byte[]body()Returns the buffer with response body.Stringfinished()Waits for this response to finish, returns alwaysnull.Frameframe()Returns theFramethat initiated this response.booleanfromServiceWorker()Indicates whether this Response was fulfilled by a Service Worker's Fetch Handler (i.e.Map<String,String>headers()An object with the response HTTP headers.List<HttpHeader>headersArray()An array with all the request HTTP headers associated with this response.StringheaderValue(String name)Returns the value of the header matching the name.List<String>headerValues(String name)Returns all values of the headers matching the name, for exampleset-cookie.booleanok()Contains a boolean stating whether the response was successful (status in the range 200-299) or not.Requestrequest()Returns the matchingRequestobject.SecurityDetailssecurityDetails()Returns SSL and other security information.ServerAddrserverAddr()Returns the IP address and port of the server.intstatus()Contains the status code of the response (e.g., 200 for a success).StringstatusText()Contains the status text of the response (e.g.Stringtext()Returns the text representation of response body.Stringurl()Contains the URL of the response.
-
-
-
Method Detail
-
allHeaders
Map<String,String> allHeaders()
An object with all the response HTTP headers associated with this response.- Since:
- v1.15
-
body
byte[] body()
Returns the buffer with response body.- Since:
- v1.8
-
finished
String finished()
Waits for this response to finish, returns alwaysnull.- Since:
- v1.8
-
frame
Frame frame()
Returns theFramethat initiated this response.- Since:
- v1.8
-
fromServiceWorker
boolean fromServiceWorker()
Indicates whether this Response was fulfilled by a Service Worker's Fetch Handler (i.e. via FetchEvent.respondWith).- Since:
- v1.23
-
headers
Map<String,String> headers()
An object with the response HTTP headers. The header names are lower-cased. Note that this method does not return security-related headers, including cookie-related ones. You can useResponse.allHeaders()for complete list of headers that includecookieinformation.- Since:
- v1.8
-
headersArray
List<HttpHeader> headersArray()
An array with all the request HTTP headers associated with this response. UnlikeResponse.allHeaders(), header names are NOT lower-cased. Headers with multiple entries, such asSet-Cookie, appear in the array multiple times.- Since:
- v1.15
-
headerValue
String headerValue(String name)
Returns the value of the header matching the name. The name is case insensitive. If multiple headers have the same name (exceptset-cookie), they are returned as a list separated by,. Forset-cookie, the\nseparator is used. If no headers are found,nullis returned.- Parameters:
name- Name of the header.- Since:
- v1.15
-
headerValues
List<String> headerValues(String name)
Returns all values of the headers matching the name, for exampleset-cookie. The name is case insensitive.- Parameters:
name- Name of the header.- Since:
- v1.15
-
ok
boolean ok()
Contains a boolean stating whether the response was successful (status in the range 200-299) or not.- Since:
- v1.8
-
request
Request request()
Returns the matchingRequestobject.- Since:
- v1.8
-
securityDetails
SecurityDetails securityDetails()
Returns SSL and other security information.- Since:
- v1.13
-
serverAddr
ServerAddr serverAddr()
Returns the IP address and port of the server.- Since:
- v1.13
-
status
int status()
Contains the status code of the response (e.g., 200 for a success).- Since:
- v1.8
-
statusText
String statusText()
Contains the status text of the response (e.g. usually an "OK" for a success).- Since:
- v1.8
-
text
String text()
Returns the text representation of response body.- Since:
- v1.8
-
url
String url()
Contains the URL of the response.- Since:
- v1.8
-
-