From 074b925917b87320c0220c0fe9df58132fff7bfd Mon Sep 17 00:00:00 2001 From: Krekoten' Marjan Date: Wed, 22 Sep 2010 17:12:23 +0300 Subject: [PATCH] Fix response header is not Array for ruby 1.9.2 --- lib/octopi/api.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/octopi/api.rb b/lib/octopi/api.rb index 9a800f4..b6a7c73 100644 --- a/lib/octopi/api.rb +++ b/lib/octopi/api.rb @@ -195,7 +195,8 @@ def submit(path, params = {}, klass=nil, format = :yaml, &block) # It happens, in tests. return resp if resp.headers.empty? - ctype = resp.headers['content-type'].first.split(";").first + content_type = Array === resp.headers['content-type'] ? resp.headers['content-type'] : [resp.headers['content-type']] + ctype = content_type.first.split(";").first raise FormatError, [ctype, format] unless CONTENT_TYPE[format.to_s].include?(ctype) if format == 'yaml' && resp['error'] raise APIError, resp['error']