Class: WebkitRemote::Client::NetworkResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/webkit_remote/client/network_events.rb

Overview

Wraps information about responses to network requests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_response) ⇒ NetworkResponse

Returns a new instance of NetworkResponse.

Parameters:

  • the (Hash<String, Number>)

    raw RPC data for a Response object in the Network domain



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_idNumber (readonly)

Returns id of the network connection used by the browser to fetch this resource.

Returns:

  • (Number)

    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_reusedBoolean (readonly)

Returns true if the network connection used for this request was already open.

Returns:

  • (Boolean)

    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_cacheBoolean (readonly)

Returns true if the request was served from cache.

Returns:

  • (Boolean)

    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

#headersHash<String, String> (readonly)

Returns HTTP response headers.

Returns:

  • (Hash<String, String>)

    HTTP response headers



383
384
385
# File 'lib/webkit_remote/client/network_events.rb', line 383

def headers
  @headers
end

#mime_typeString (readonly)

Returns the browser-determined response MIME type.

Returns:

  • (String)

    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_headersHash<String, String> (readonly)

Returns HTTP request headers.

Returns:

  • (Hash<String, String>)

    HTTP request headers



389
390
391
# File 'lib/webkit_remote/client/network_events.rb', line 389

def request_headers
  @request_headers
end

#statusNumber (readonly)

Returns HTTP status code.

Returns:

  • (Number)

    HTTP status code



377
378
379
# File 'lib/webkit_remote/client/network_events.rb', line 377

def status
  @status
end

#status_textString (readonly)

Returns HTTP status message.

Returns:

  • (String)

    HTTP status message



380
381
382
# File 'lib/webkit_remote/client/network_events.rb', line 380

def status_text
  @status_text
end

#urlString (readonly)

Returns the URL of the response.

Returns:

  • (String)

    the URL of the response



374
375
376
# File 'lib/webkit_remote/client/network_events.rb', line 374

def url
  @url
end