From b272bbaf0fa992e7f391611e095c6f795c3f3fcd Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Sun, 20 Feb 2011 15:28:40 +0100 Subject: [PATCH] document headers helper, improve documentation for status helper --- README.rdoc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.rdoc b/README.rdoc index 92d1174d..c29fa075 100644 --- a/README.rdoc +++ b/README.rdoc @@ -785,7 +785,7 @@ a duplicate, use call! instead of call. Check out the Rack specification if you want to learn more about call. -=== Setting Body and Status Code +=== Setting Body, Status Code and Headers It is possible and recommended to set the status code and response body with the return value of the route block. However, in some scenarios you might want to @@ -804,13 +804,19 @@ access the body: It is also possible to pass a block to +body+, that will be executed by the Rack handler (this can be used to implement streaming, see "Return Values"). -Similar to +body+, you can also set the status code: +Similar to +body+, you can also set the status code and headers: get '/foo' do status 418 - halt "I'm a tea pot!" + headers \ + "Allow" => "BREW, POST, GET, PROPFIND, WHEN" + "Refresh" => "Refresh: 20; http://www.ietf.org/rfc/rfc2324.txt" + body "I'm a tea pot!" end +Like +body+, +headers+ and +status+ with no arguments can be used to access +their current values. + === Generating URLs For generating URLs you should use the +url+ helper method, for instance, in