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.
6 7 8 |
# File 'lib/playwright_api/response.rb', line 6 def all_headers wrap_impl(@impl.all_headers) end |
#body ⇒ Object
Returns the buffer with response body.
11 12 13 |
# File 'lib/playwright_api/response.rb', line 11 def body wrap_impl(@impl.body) end |
#finished ⇒ Object
Waits for this response to finish, returns always ‘null`.
16 17 18 |
# File 'lib/playwright_api/response.rb', line 16 def finished wrap_impl(@impl.finished) end |
#frame ⇒ Object
Returns the ‘Frame` that initiated this response.
21 22 23 |
# File 'lib/playwright_api/response.rb', line 21 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)).
27 28 29 |
# File 'lib/playwright_api/response.rb', line 27 def from_service_worker wrap_impl(@impl.from_service_worker) end |
#from_service_worker? ⇒ Boolean
104 105 106 |
# File 'lib/playwright_api/response.rb', line 104 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.
47 48 49 |
# File 'lib/playwright_api/response.rb', line 47 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.
52 53 54 |
# File 'lib/playwright_api/response.rb', line 52 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.
34 35 36 |
# File 'lib/playwright_api/response.rb', line 34 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.
40 41 42 |
# File 'lib/playwright_api/response.rb', line 40 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`.
59 60 61 |
# File 'lib/playwright_api/response.rb', line 59 def json wrap_impl(@impl.json) end |
#off(event, callback) ⇒ Object
– inherited from EventEmitter –
115 116 117 |
# File 'lib/playwright_api/response.rb', line 115 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.
64 65 66 |
# File 'lib/playwright_api/response.rb', line 64 def ok wrap_impl(@impl.ok) end |
#ok? ⇒ Boolean
109 110 111 |
# File 'lib/playwright_api/response.rb', line 109 def ok? wrap_impl(@impl.ok?) end |
#on(event, callback) ⇒ Object
– inherited from EventEmitter –
127 128 129 |
# File 'lib/playwright_api/response.rb', line 127 def on(event, callback) event_emitter_proxy.on(event, callback) end |
#once(event, callback) ⇒ Object
– inherited from EventEmitter –
121 122 123 |
# File 'lib/playwright_api/response.rb', line 121 def once(event, callback) event_emitter_proxy.once(event, callback) end |
#request ⇒ Object
Returns the matching ‘Request` object.
69 70 71 |
# File 'lib/playwright_api/response.rb', line 69 def request wrap_impl(@impl.request) end |
#security_details ⇒ Object
Returns SSL and other security information.
74 75 76 |
# File 'lib/playwright_api/response.rb', line 74 def security_details wrap_impl(@impl.security_details) end |
#server_addr ⇒ Object
Returns the IP address and port of the server.
79 80 81 |
# File 'lib/playwright_api/response.rb', line 79 def server_addr wrap_impl(@impl.server_addr) end |
#status ⇒ Object
Contains the status code of the response (e.g., 200 for a success).
84 85 86 |
# File 'lib/playwright_api/response.rb', line 84 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).
89 90 91 |
# File 'lib/playwright_api/response.rb', line 89 def status_text wrap_impl(@impl.status_text) end |
#text ⇒ Object
Returns the text representation of response body.
94 95 96 |
# File 'lib/playwright_api/response.rb', line 94 def text wrap_impl(@impl.text) end |
#url ⇒ Object
Contains the URL of the response.
99 100 101 |
# File 'lib/playwright_api/response.rb', line 99 def url wrap_impl(@impl.url) end |