Method: HTTP::Message.internal_mime_type
- Defined in:
- lib/httpclient/http.rb
.internal_mime_type(path) ⇒ Object
Default MIME type handler. See mime_type_handler=.
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 |
# File 'lib/httpclient/http.rb', line 808 def internal_mime_type(path) case path when /\.txt$/i 'text/plain' when /\.xml$/i 'text/xml' when /\.(htm|html)$/i 'text/html' when /\.doc$/i 'application/msword' when /\.png$/i 'image/png' when /\.gif$/i 'image/gif' when /\.(jpg|jpeg)$/i 'image/jpeg' else 'application/octet-stream' end end |