awestruct/awestruct — pull request #155 by statonjr (2012-08-10 02:41:34+00:00)
Title: Add support for MIME types

Awestruct::Rack::App did not set the correct Content-Type header for media types other than HTML. Rack defaults the Content-Type header to 'text/html' for HTML and to 'text/plain' for everything else. This change adds support for MIME types by using Rack::Mime to send the correct MIME type based on the file extension.

This change also sets the 'Content-Length' header and sends the body as an array since sending the body as a string can break in Ruby 1.9 (see the commented code pulled from the Rack spec).

Finally, the Gemfile has been updated to load the correct lib based on platform.