Class: WebkitRemote::Client::NetworkResponse
- Inherits:
-
Object
- Object
- WebkitRemote::Client::NetworkResponse
- Defined in:
- lib/webkit_remote/client/network_events.rb
Overview
Wraps information about responses to network requests.
Instance Attribute Summary collapse
-
#connection_id ⇒ Number
readonly
Id of the network connection used by the browser to fetch this resource.
-
#connection_reused ⇒ Boolean
readonly
True if the network connection used for this request was already open.
-
#from_cache ⇒ Boolean
readonly
True if the request was served from cache.
-
#headers ⇒ Hash<String, String>
readonly
HTTP response headers.
-
#mime_type ⇒ String
readonly
The browser-determined response MIME type.
-
#request_headers ⇒ Hash<String, String>
readonly
HTTP request headers.
-
#status ⇒ Number
readonly
HTTP status code.
-
#status_text ⇒ String
readonly
HTTP status message.
-
#url ⇒ String
readonly
The URL of the response.
Instance Method Summary collapse
-
#initialize(raw_response) ⇒ NetworkResponse
constructor
A new instance of NetworkResponse.
Constructor Details
#initialize(raw_response) ⇒ NetworkResponse
Returns a new instance of NetworkResponse.
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
# File 'lib/webkit_remote/client/network_events.rb', line 406 def initialize(raw_response) @connection_id = raw_response['connectionId'] @connection_reused = raw_response['connectionReused'] || false @from_cache = raw_response['fromDiskCache'] || false @headers = raw_response['headers'] || {} @mime_type = raw_response['mimeType'] @request_headers = raw_response['requestHeaders'] || {} @status = raw_response['status'] @status_text = raw_response['statusText'] if raw_response['timing'] @timing = WebkitRemote::Client::NetworkResourceTiming.new( raw_response['timing']) else @timing = nil end @url = raw_response['url'] end |
Instance Attribute Details
#connection_id ⇒ Number (readonly)
Returns id of the network connection used by the browser to fetch this resource.
396 397 398 |
# File 'lib/webkit_remote/client/network_events.rb', line 396 def connection_id @connection_id end |
#connection_reused ⇒ Boolean (readonly)
Returns true if the network connection used for this request was already open.
400 401 402 |
# File 'lib/webkit_remote/client/network_events.rb', line 400 def connection_reused @connection_reused end |
#from_cache ⇒ Boolean (readonly)
Returns true if the request was served from cache.
392 393 394 |
# File 'lib/webkit_remote/client/network_events.rb', line 392 def from_cache @from_cache end |
#headers ⇒ Hash<String, String> (readonly)
Returns HTTP response headers.
383 384 385 |
# File 'lib/webkit_remote/client/network_events.rb', line 383 def headers @headers end |
#mime_type ⇒ String (readonly)
Returns the browser-determined response MIME type.
386 387 388 |
# File 'lib/webkit_remote/client/network_events.rb', line 386 def mime_type @mime_type end |
#request_headers ⇒ Hash<String, String> (readonly)
Returns HTTP request headers.
389 390 391 |
# File 'lib/webkit_remote/client/network_events.rb', line 389 def request_headers @request_headers end |
#status ⇒ Number (readonly)
Returns HTTP status code.
377 378 379 |
# File 'lib/webkit_remote/client/network_events.rb', line 377 def status @status end |
#status_text ⇒ String (readonly)
Returns HTTP status message.
380 381 382 |
# File 'lib/webkit_remote/client/network_events.rb', line 380 def status_text @status_text end |
#url ⇒ String (readonly)
Returns the URL of the response.
374 375 376 |
# File 'lib/webkit_remote/client/network_events.rb', line 374 def url @url end |