Override the default Response implementation to include methods useful for testing.

Methods
Attributes
[RW] response_cookies The Response cookies.
[RW] response_headers The Response headers.
[RW] status The Response status.
Public Instance methods
add_cookie(cookie, value = nil)

Add a cookie to the response. Better use this method to avoid precreating the cookies array for every request.

Examples

add_cookie(‘nsid’, ‘gmosx’) add_cookie(Cookie.new(‘nsid’, ‘gmosx’)

This method is also aliased as send_cookie
    # File lib/raw/context/response.rb, line 40
40:   def add_cookie(cookie, value = nil)
41:     if value
42:       (@response_cookies ||= []) << Cookie.new(cookie, value)
43:     else 
44:       (@response_cookies ||= []) << cookie
45:     end
46:   end
body()

Return the output buffer.

    # File lib/raw/context/response.rb, line 51
51:   def body
52:     @output_buffer
53:   end
content_type()

Return the content type for this response.

    # File lib/raw/context/response.rb, line 21
21:   def content_type
22:     @response_headers["Content-Type"]
23:   end
content_type=(ctype)

Set the content type for this response.

    # File lib/raw/context/response.rb, line 27
27:   def content_type=(ctype)
28:     @response_headers["Content-Type"] = ctype
29:   end
redirect?()
    # File lib/raw/test/context.rb, line 24
24:   def redirect?
25:     (300..399).include?(@status)
26:   end
redirect_uri()
    # File lib/raw/test/context.rb, line 28
28:   def redirect_uri
29:     @response_headers['location']
30:   end
response_cookie(name)
    # File lib/raw/test/context.rb, line 32
32:   def response_cookie(name)
33:     return nil unless @response_cookies
34:     @response_cookies.find { |c| c.name == name }
35:   end
send_cookie(cookie, value = nil)

Alias for #add_cookie

status_ok?()
    # File lib/raw/test/context.rb, line 20
20:   def status_ok?
21:     @status == 200
22:   end