diff options
Diffstat (limited to 'lib/webrick/httpresponse.rb')
-rw-r--r-- | lib/webrick/httpresponse.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb index 121f5e6464..9942a59714 100644 --- a/lib/webrick/httpresponse.rb +++ b/lib/webrick/httpresponse.rb @@ -51,8 +51,21 @@ module WEBrick attr_accessor :reason_phrase ## - # Body may be a String or IO-like object that responds to #read and - # #readpartial. + # Body may be: + # * a String; + # * an IO-like object that responds to +#read+ and +#readpartial+; + # * a Proc-like object that responds to +#call+. + # + # In the latter case, either #chunked= should be set to +true+, + # or <code>header['content-length']</code> explicitly provided. + # Example: + # + # server.mount_proc '/' do |req, res| + # res.chunked = true + # # or + # # res.header['content-length'] = 10 + # res.body = proc { |out| out.write(Time.now.to_s) } + # end attr_accessor :body |