Class: Playwright::Response
- Inherits:
-
PlaywrightApi
- Object
- PlaywrightApi
- Playwright::Response
- Defined in:
- lib/playwright_api/response.rb
Overview
‘Response` class represents responses which are received by page.
Instance Method Summary collapse
-
#all_headers ⇒ Object
An object with all the response HTTP headers associated with this response.
-
#body ⇒ Object
Returns the buffer with response body.
-
#finished ⇒ Object
Waits for this response to finish, returns always ‘null`.
-
#frame ⇒ Object
Returns the ‘Frame` that initiated this response.
-
#from_service_worker ⇒ Object
Indicates whether this Response was fulfilled by a Service Worker’s Fetch Handler (i.e. via [FetchEvent.respondWith](developer.mozilla.org/en-US/docs/Web/API/FetchEvent/respondWith)).
- #from_service_worker? ⇒ Boolean
-
#header_value(name) ⇒ Object
Returns the value of the header matching the name.
-
#header_values(name) ⇒ Object
Returns all values of the headers matching the name, for example ‘set-cookie`.
-
#headers ⇒ Object
An object with the response HTTP headers.
-
#headers_array ⇒ Object
An array with all the request HTTP headers associated with this response.
-
#json ⇒ Object
Returns the JSON representation of response body.
-
#off(event, callback) ⇒ Object
– inherited from EventEmitter –.
-
#ok ⇒ Object
Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
- #ok? ⇒ Boolean
-
#on(event, callback) ⇒ Object
– inherited from EventEmitter –.
-
#once(event, callback) ⇒ Object
– inherited from EventEmitter –.
-
#request ⇒ Object
Returns the matching ‘Request` object.
-
#security_details ⇒ Object
Returns SSL and other security information.
-
#server_addr ⇒ Object
Returns the IP address and port of the server.
-
#status ⇒ Object
Contains the status code of the response (e.g., 200 for a success).
-
#status_text ⇒ Object
Contains the status text of the response (e.g. usually an “OK” for a success).
-
#text ⇒ Object
Returns the text representation of response body.
-
#url ⇒ Object
Contains the URL of the response.
Methods inherited from PlaywrightApi
Constructor Details
This class inherits a constructor from Playwright::PlaywrightApi
Instance Method Details
#all_headers ⇒ Object
An object with all the response HTTP headers associated with this response.
8 9 10 |
# File 'lib/playwright_api/response.rb', line 8 def all_headers wrap_impl(@impl.all_headers) end |
#body ⇒ Object
Returns the buffer with response body.
14 15 16 |
# File 'lib/playwright_api/response.rb', line 14 def body wrap_impl(@impl.body) end |
#finished ⇒ Object
Waits for this response to finish, returns always ‘null`.
20 21 22 |
# File 'lib/playwright_api/response.rb', line 20 def finished wrap_impl(@impl.finished) end |
#frame ⇒ Object
Returns the ‘Frame` that initiated this response.
26 27 28 |
# File 'lib/playwright_api/response.rb', line 26 def frame wrap_impl(@impl.frame) end |
#from_service_worker ⇒ Object
Indicates whether this Response was fulfilled by a Service Worker’s Fetch Handler (i.e. via [FetchEvent.respondWith](developer.mozilla.org/en-US/docs/Web/API/FetchEvent/respondWith)).
32 33 34 |
# File 'lib/playwright_api/response.rb', line 32 def from_service_worker wrap_impl(@impl.from_service_worker) end |
#from_service_worker? ⇒ Boolean
121 122 123 |
# File 'lib/playwright_api/response.rb', line 121 def from_service_worker? wrap_impl(@impl.from_service_worker?) end |
#header_value(name) ⇒ Object
Returns the value of the header matching the name. The name is case insensitive. If multiple headers have the same name (except ‘set-cookie`), they are returned as a list separated by `, `. For `set-cookie`, the `n` separator is used. If no headers are found, `null` is returned.
54 55 56 |
# File 'lib/playwright_api/response.rb', line 54 def header_value(name) wrap_impl(@impl.header_value(unwrap_impl(name))) end |
#header_values(name) ⇒ Object
Returns all values of the headers matching the name, for example ‘set-cookie`. The name is case insensitive.
60 61 62 |
# File 'lib/playwright_api/response.rb', line 60 def header_values(name) wrap_impl(@impl.header_values(unwrap_impl(name))) end |
#headers ⇒ Object
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 use [‘method: Response.allHeaders`] for complete list of headers that include `cookie` information.
40 41 42 |
# File 'lib/playwright_api/response.rb', line 40 def headers wrap_impl(@impl.headers) end |
#headers_array ⇒ Object
An array with all the request HTTP headers associated with this response. Unlike [‘method: Response.allHeaders`], header names are NOT lower-cased. Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
47 48 49 |
# File 'lib/playwright_api/response.rb', line 47 def headers_array wrap_impl(@impl.headers_array) end |
#json ⇒ Object
Returns the JSON representation of response body.
This method will throw if the response body is not parsable via ‘JSON.parse`.
68 69 70 |
# File 'lib/playwright_api/response.rb', line 68 def json wrap_impl(@impl.json) end |
#off(event, callback) ⇒ Object
– inherited from EventEmitter –
132 133 134 |
# File 'lib/playwright_api/response.rb', line 132 def off(event, callback) event_emitter_proxy.off(event, callback) end |
#ok ⇒ Object
Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
74 75 76 |
# File 'lib/playwright_api/response.rb', line 74 def ok wrap_impl(@impl.ok) end |
#ok? ⇒ Boolean
126 127 128 |
# File 'lib/playwright_api/response.rb', line 126 def ok? wrap_impl(@impl.ok?) end |
#on(event, callback) ⇒ Object
– inherited from EventEmitter –
144 145 146 |
# File 'lib/playwright_api/response.rb', line 144 def on(event, callback) event_emitter_proxy.on(event, callback) end |
#once(event, callback) ⇒ Object
– inherited from EventEmitter –
138 139 140 |
# File 'lib/playwright_api/response.rb', line 138 def once(event, callback) event_emitter_proxy.once(event, callback) end |
#request ⇒ Object
Returns the matching ‘Request` object.
80 81 82 |
# File 'lib/playwright_api/response.rb', line 80 def request wrap_impl(@impl.request) end |
#security_details ⇒ Object
Returns SSL and other security information.
86 87 88 |
# File 'lib/playwright_api/response.rb', line 86 def security_details wrap_impl(@impl.security_details) end |
#server_addr ⇒ Object
Returns the IP address and port of the server.
92 93 94 |
# File 'lib/playwright_api/response.rb', line 92 def server_addr wrap_impl(@impl.server_addr) end |
#status ⇒ Object
Contains the status code of the response (e.g., 200 for a success).
98 99 100 |
# File 'lib/playwright_api/response.rb', line 98 def status wrap_impl(@impl.status) end |
#status_text ⇒ Object
Contains the status text of the response (e.g. usually an “OK” for a success).
104 105 106 |
# File 'lib/playwright_api/response.rb', line 104 def status_text wrap_impl(@impl.status_text) end |
#text ⇒ Object
Returns the text representation of response body.
110 111 112 |
# File 'lib/playwright_api/response.rb', line 110 def text wrap_impl(@impl.text) end |
#url ⇒ Object
Contains the URL of the response.
116 117 118 |
# File 'lib/playwright_api/response.rb', line 116 def url wrap_impl(@impl.url) end |