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, unwrap, wrap

Constructor Details

This class inherits a constructor from Playwright::PlaywrightApi

Instance Method Details

#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 –



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

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)


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

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

#on(event, callback) ⇒ Object

– inherited from EventEmitter –



91
92
93
# File 'lib/playwright_api/response.rb', line 91

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

#once(event, callback) ⇒ Object

– inherited from EventEmitter –



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

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

#security_detailsObject

Returns SSL and other security information.



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

def security_details
  wrap_impl(@impl.security_details)
end

#server_addrObject

Returns the IP address and port of the server.



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

def server_addr
  wrap_impl(@impl.server_addr)
end

#statusObject

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



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

def status
  wrap_impl(@impl.status)
end

#status_textObject

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



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

def status_text
  wrap_impl(@impl.status_text)
end

#textObject

Returns the text representation of response body.



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

def text
  wrap_impl(@impl.text)
end

#urlObject

Contains the URL of the response.



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

def url
  wrap_impl(@impl.url)
end