Class: WebkitRemote::Client::NetworkRequest

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

Overview

Wraps information about HTTP requests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_response) ⇒ NetworkRequest

Returns a new instance of NetworkRequest.

Parameters:

  • the (Hash<String, Number>)

    raw RPC data for a Response object in the Network domain



362
363
364
365
366
367
368
# File 'lib/webkit_remote/client/network_events.rb', line 362

def initialize(raw_response)
  @headers = raw_response['headers'] || {}
  @method = raw_response['method'] ? raw_response['method'].downcase.to_sym :
            nil
  @body = raw_response['postData']
  @url = raw_response['url']
end

Instance Attribute Details

#bodyString (readonly)

Returns the body of a POST request.

Returns:

  • (String)

    the body of a POST request



356
357
358
# File 'lib/webkit_remote/client/network_events.rb', line 356

def body
  @body
end

#headersHash<String, String> (readonly)

Returns the HTTP headers of the request.

Returns:

  • (Hash<String, String>)

    the HTTP headers of the request



353
354
355
# File 'lib/webkit_remote/client/network_events.rb', line 353

def headers
  @headers
end

#methodSymbol? (readonly)

Returns HTTP request method, e.g. :get.

Returns:

  • (Symbol, nil)

    HTTP request method, e.g. :get



350
351
352
# File 'lib/webkit_remote/client/network_events.rb', line 350

def method
  @method
end

#urlString (readonly)

Returns the URL of the request.

Returns:

  • (String)

    the URL of the request



347
348
349
# File 'lib/webkit_remote/client/network_events.rb', line 347

def url
  @url
end