improve documentation for content_type, move into helpers section

This commit is contained in:
Konstantin Haase 2011-02-20 15:44:18 +01:00
parent 7f7da82aa0
commit e2ddc57eb0
1 changed files with 14 additions and 11 deletions

View File

@ -848,6 +848,20 @@ Similar to +body+, you can also set the status code and headers:
Like +body+, +headers+ and +status+ with no arguments can be used to access
their current values.
=== Mime Types
When using <tt>send_file</tt> or static files you may have mime types Sinatra
doesn't understand. Use +mime_type+ to register them by file extension:
mime_type :foo, 'text/foo'
You can also use it with the +content_type+ helper:
get '/' do
content_type :foo
"foo foo foo"
end
=== Generating URLs
For generating URLs you should use the +url+ helper method, for instance, in
@ -1216,17 +1230,6 @@ Or a range:
Sinatra installs special <tt>not_found</tt> and <tt>error</tt> handlers when
running under the development environment.
== Mime Types
When using <tt>send_file</tt> or static files you may have mime types Sinatra
doesn't understand. Use +mime_type+ to register them by file extension:
mime_type :foo, 'text/foo'
You can also use it with the +content_type+ helper:
content_type :foo
== Rack Middleware
Sinatra rides on Rack[http://rack.rubyforge.org/], a minimal standard