Class: HttpArchive::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/http_archive/classes.rb

Overview

Holds information about the response for an interaction

Instance Attribute Summary collapse

Instance Attribute Details

#body_sizeFixnum

Size of the response body

Returns:

  • (Fixnum)

    body size of this request in bytes, -1 if not available, 0 if from cache


130
131
132
# File 'lib/http_archive/classes.rb', line 130

def body_size
  @body_size
end

#contentHash

Content of the response body

Examples:

{"mimeType"=>"text/html", "size"=>0}

Returns:

  • (Hash)

    response body objects (strings) as a hash


135
136
137
# File 'lib/http_archive/classes.rb', line 135

def content
  @content
end

#cookiesArray

A list of cookie objects for this response

Returns:

  • (Array)

    list of cookie objects as an array


119
120
121
# File 'lib/http_archive/classes.rb', line 119

def cookies
  @cookies
end

#headersHash

The headers of this response

Examples:

{"Date"=>"...", "Server"=>"...", "Location"=>"...", "Cache-Control"=>"...", "Expires"=>"...", "Content-Length"=>"...", "Keep-Alive"=>"...", "Connection"=>"...", "Content-Type"=>"..."}

Returns:

  • (Hash)

    header objects (strings) as a hash


124
125
126
# File 'lib/http_archive/classes.rb', line 124

def headers
  @headers
end

#headers_sizeFixnum

Size of the response header

Returns:

  • (Fixnum)

    header size of this response in bytes, -1 if not available


127
128
129
# File 'lib/http_archive/classes.rb', line 127

def headers_size
  @headers_size
end

#http_versionString

The HTTP version of this response

Returns:

  • (String)

    HTTP version as string, e.g. “HTTP/1.1”


116
117
118
# File 'lib/http_archive/classes.rb', line 116

def http_version
  @http_version
end

#redirect_urlString

Redirection target URL from location response header.

Returns:

  • (String)

    redirect URL as string, e.g. “blog/index.php”


138
139
140
# File 'lib/http_archive/classes.rb', line 138

def redirect_url
  @redirect_url
end

#statusFixnum

The status of this request

Returns:

  • (Fixnum)

    response status as number, e.g. 200


110
111
112
# File 'lib/http_archive/classes.rb', line 110

def status
  @status
end

#status_textString

The status of this request as text description

Returns:

  • (String)

    response status as string, e.g. “OK”


113
114
115
# File 'lib/http_archive/classes.rb', line 113

def status_text
  @status_text
end