Class: Playwright::APIResponse
- Inherits:
-
PlaywrightApi
- Object
- PlaywrightApi
- Playwright::APIResponse
- Defined in:
- lib/playwright_api/api_response.rb
Overview
`APIResponse` class represents responses returned by [`method: APIRequestContext.get`] and similar methods.
Instance Method Summary collapse
-
#body ⇒ Object
Returns the buffer with response body.
-
#dispose ⇒ Object
Disposes the body of this response.
-
#headers ⇒ Object
An object with all the response HTTP headers associated with this response.
-
#headers_array ⇒ Object
An array with all the request HTTP headers associated with this response.
-
#json ⇒ Object
Returns the JSON representation of response body.
-
#ok ⇒ Object
Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
- #ok? ⇒ Boolean
-
#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.
- #to_s ⇒ Object
-
#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
#body ⇒ Object
Returns the buffer with response body.
6 7 8 |
# File 'lib/playwright_api/api_response.rb', line 6 def body wrap_impl(@impl.body) end |
#dispose ⇒ Object
Disposes the body of this response. If not called then the body will stay in memory until the context closes.
11 12 13 |
# File 'lib/playwright_api/api_response.rb', line 11 def dispose wrap_impl(@impl.dispose) end |
#headers ⇒ Object
An object with all the response HTTP headers associated with this response.
16 17 18 |
# File 'lib/playwright_api/api_response.rb', line 16 def headers wrap_impl(@impl.headers) end |
#headers_array ⇒ Object
An array with all the request HTTP headers associated with this response. Header names are not lower-cased. Headers with multiple entries, such as `Set-Cookie`, appear in the array multiple times.
22 23 24 |
# File 'lib/playwright_api/api_response.rb', line 22 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`.
29 30 31 |
# File 'lib/playwright_api/api_response.rb', line 29 def json wrap_impl(@impl.json) end |
#ok ⇒ Object
Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
34 35 36 |
# File 'lib/playwright_api/api_response.rb', line 34 def ok wrap_impl(@impl.ok) end |
#ok? ⇒ Boolean
59 60 61 |
# File 'lib/playwright_api/api_response.rb', line 59 def ok? wrap_impl(@impl.ok?) end |
#status ⇒ Object
Contains the status code of the response (e.g., 200 for a success).
39 40 41 |
# File 'lib/playwright_api/api_response.rb', line 39 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).
44 45 46 |
# File 'lib/playwright_api/api_response.rb', line 44 def status_text wrap_impl(@impl.status_text) end |
#text ⇒ Object
Returns the text representation of response body.
49 50 51 |
# File 'lib/playwright_api/api_response.rb', line 49 def text wrap_impl(@impl.text) end |
#to_s ⇒ Object
64 65 66 |
# File 'lib/playwright_api/api_response.rb', line 64 def to_s wrap_impl(@impl.to_s) end |
#url ⇒ Object
Contains the URL of the response.
54 55 56 |
# File 'lib/playwright_api/api_response.rb', line 54 def url wrap_impl(@impl.url) end |