Class: Playwright::Response

Inherits:
PlaywrightApi show all
Defined in:
lib/playwright_api/response.rb

Overview

‘Response` class represents responses which are received by page.

Instance Method Summary collapse

Methods inherited from PlaywrightApi

#==, #initialize, wrap

Constructor Details

This class inherits a constructor from Playwright::PlaywrightApi

Instance Method Details

#after_initializeObject



68
69
70
# File 'lib/playwright_api/response.rb', line 68

def after_initialize
  wrap_impl(@impl.after_initialize)
end

#bodyObject

Returns the buffer with response body.



6
7
8
# File 'lib/playwright_api/response.rb', line 6

def body
  wrap_impl(@impl.body)
end

#finishedObject

Waits for this response to finish, returns failure error if request failed.



11
12
13
# File 'lib/playwright_api/response.rb', line 11

def finished
  wrap_impl(@impl.finished)
end

#frameObject

Returns the ‘Frame` that initiated this response.



16
17
18
# File 'lib/playwright_api/response.rb', line 16

def frame
  wrap_impl(@impl.frame)
end

#headersObject

Returns the object with HTTP headers associated with the response. All header names are lower-case.



21
22
23
# File 'lib/playwright_api/response.rb', line 21

def headers
  wrap_impl(@impl.headers)
end

#jsonObject

Returns the JSON representation of response body.

This method will throw if the response body is not parsable via ‘JSON.parse`.



28
29
30
# File 'lib/playwright_api/response.rb', line 28

def json
  wrap_impl(@impl.json)
end

#off(event, callback) ⇒ Object

– inherited from EventEmitter –



74
75
76
# File 'lib/playwright_api/response.rb', line 74

def off(event, callback)
  event_emitter_proxy.off(event, callback)
end

#okObject

Contains a boolean stating whether the response was successful (status in the range 200-299) or not.



33
34
35
# File 'lib/playwright_api/response.rb', line 33

def ok
  wrap_impl(@impl.ok)
end

#ok?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/playwright_api/response.rb', line 63

def ok?
  wrap_impl(@impl.ok?)
end

#on(event, callback) ⇒ Object

– inherited from EventEmitter –



86
87
88
# File 'lib/playwright_api/response.rb', line 86

def on(event, callback)
  event_emitter_proxy.on(event, callback)
end

#once(event, callback) ⇒ Object

– inherited from EventEmitter –



80
81
82
# File 'lib/playwright_api/response.rb', line 80

def once(event, callback)
  event_emitter_proxy.once(event, callback)
end

#requestObject

Returns the matching ‘Request` object.



38
39
40
# File 'lib/playwright_api/response.rb', line 38

def request
  wrap_impl(@impl.request)
end

#statusObject

Contains the status code of the response (e.g., 200 for a success).



43
44
45
# File 'lib/playwright_api/response.rb', line 43

def status
  wrap_impl(@impl.status)
end

#status_textObject

Contains the status text of the response (e.g. usually an “OK” for a success).



48
49
50
# File 'lib/playwright_api/response.rb', line 48

def status_text
  wrap_impl(@impl.status_text)
end

#textObject

Returns the text representation of response body.



53
54
55
# File 'lib/playwright_api/response.rb', line 53

def text
  wrap_impl(@impl.text)
end

#urlObject

Contains the URL of the response.



58
59
60
# File 'lib/playwright_api/response.rb', line 58

def url
  wrap_impl(@impl.url)
end