Module: Webrat::MIME

Defined in:
lib/webrat/core/mime.rb

Overview

:nodoc:

Constant Summary collapse

MIME_TYPES =
Rack::Mime::MIME_TYPES.dup.merge(
  ".multipart_form"   => "multipart/form-data",
  ".url_encoded_form" => "application/x-www-form-urlencoded"
).freeze

Class Method Summary collapse

Class Method Details

.mime_type(type) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/webrat/core/mime.rb', line 8

def mime_type(type)
  return type if type.nil? || type.to_s.include?("/")
  type = ".#{type}" unless type.to_s[0] == ?.
  MIME_TYPES.fetch(type) { |type|
    raise ArgumentError.new("Invalid Mime type: #{type}")
  }
end