lib/restfully/parsing.rb in restfully-0.5.4 vs lib/restfully/parsing.rb in restfully-0.5.5
- old
+ new
@@ -52,9 +52,10 @@
raise ParserNotFound.new("Cannot find a parser to dump object into '#{content_type}' content.")
end
end
def select_parser_for(content_type)
+ raise ParserNotFound.new("The Content-Type HTTP header of the resource is empty. Cannot find a parser.") if content_type.nil? || content_type.empty?
content_type.split(",").each do |type|
parser = PARSERS.find{|parser| parser[:supported_types].find{|supported_type| type =~ (supported_type.kind_of?(String) ? Regexp.new(supported_type) : supported_type) }}
return parser unless parser.nil?
end
nil
\ No newline at end of file