Class | Rack::Response
In: | lib/rack/response.rb
Parent: | Object

Rack::Response provides a convenient interface to create a Rack response.

It allows setting of headers and cookies, and provides useful defaults (a OK response containing HTML).

You can use Response#write to iteratively generate your response, but note that this is buffered by Rack::Response until you call `finish`. `finish` however can take a block inside which calls to `write` are synchronous with the Rack response.

Your application‘s `call` should end returning Response#finish.

### Methods

[] []= close delete_cookie each empty? finish new redirect set_cookie to_a to_ary write

### Included Modules

Helpers

### Classes and Modules

Module Rack::Response::Helpers

### Constants

CHUNKED | = | 'chunked'.freeze
TRANSFER_ENCODING | = | 'Transfer-Encoding'.freeze

### External Aliases

header | -> | headers

### Attributes

body | [RW] |
header | [R] |
length | [RW] |
status | [RW] |

### Public Class methods

new(body=[], status=200, header={}) {|self if block_given?| ...}

### Public Instance methods

[](key)
[]=(key, value)
close()
delete_cookie(key, value={})
each(&callback)
empty?()
finish(&block)
redirect(target, status=302)
set_cookie(key, value)
to_a(&block)

Alias for finish

to_ary(&block)

Alias for finish

write(str)

Append to body and update Content-Length.

NOTE: Do not mix write and direct body access!

[Validate]