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.
-
#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
*DEPRECATED* Incomplete list of headers as seen by the rendering engine.
-
#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 |
#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.
39 40 41 |
# File 'lib/playwright_api/response.rb', line 39 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.
44 45 46 |
# File 'lib/playwright_api/response.rb', line 44 def header_values(name) wrap_impl(@impl.header_values(unwrap_impl(name))) end |
#headers ⇒ Object
*DEPRECATED* Incomplete list of headers as seen by the rendering engine. Use [`method: Response.allHeaders`] instead.
26 27 28 |
# File 'lib/playwright_api/response.rb', line 26 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.
32 33 34 |
# File 'lib/playwright_api/response.rb', line 32 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`.
51 52 53 |
# File 'lib/playwright_api/response.rb', line 51 def json wrap_impl(@impl.json) end |
#off(event, callback) ⇒ Object
– inherited from EventEmitter –
114 115 116 |
# File 'lib/playwright_api/response.rb', line 114 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.
56 57 58 |
# File 'lib/playwright_api/response.rb', line 56 def ok wrap_impl(@impl.ok) end |
#ok? ⇒ Boolean
96 97 98 |
# File 'lib/playwright_api/response.rb', line 96 def ok? wrap_impl(@impl.ok?) end |
#on(event, callback) ⇒ Object
– inherited from EventEmitter –
108 109 110 |
# File 'lib/playwright_api/response.rb', line 108 def on(event, callback) event_emitter_proxy.on(event, callback) end |
#once(event, callback) ⇒ Object
– inherited from EventEmitter –
102 103 104 |
# File 'lib/playwright_api/response.rb', line 102 def once(event, callback) event_emitter_proxy.once(event, callback) end |
#request ⇒ Object
Returns the matching `Request` object.
61 62 63 |
# File 'lib/playwright_api/response.rb', line 61 def request wrap_impl(@impl.request) end |
#security_details ⇒ Object
Returns SSL and other security information.
66 67 68 |
# File 'lib/playwright_api/response.rb', line 66 def security_details wrap_impl(@impl.security_details) end |
#server_addr ⇒ Object
Returns the IP address and port of the server.
71 72 73 |
# File 'lib/playwright_api/response.rb', line 71 def server_addr wrap_impl(@impl.server_addr) end |
#status ⇒ Object
Contains the status code of the response (e.g., 200 for a success).
76 77 78 |
# File 'lib/playwright_api/response.rb', line 76 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).
81 82 83 |
# File 'lib/playwright_api/response.rb', line 81 def status_text wrap_impl(@impl.status_text) end |
#text ⇒ Object
Returns the text representation of response body.
86 87 88 |
# File 'lib/playwright_api/response.rb', line 86 def text wrap_impl(@impl.text) end |
#url ⇒ Object
Contains the URL of the response.
91 92 93 |
# File 'lib/playwright_api/response.rb', line 91 def url wrap_impl(@impl.url) end |