7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/restman/request/stringify_headers.rb', line 7
def call
.inject({}) do |result, (key, value)|
if key.is_a? Symbol
key = key.to_s.split(/_/).map(&:capitalize).join('-')
end
if 'CONTENT-TYPE' == key.upcase
result[key] = MaybeConvertExtension.call(value.to_s)
elsif 'ACCEPT' == key.upcase
if value.is_a? Array
target_values = value
else
target_values = value.to_s.split ','
end
result[key] = target_values.map { |ext|
MaybeConvertExtension.call(ext.to_s.strip)
}.join(', ')
else
result[key] = value.to_s
end
result
end
end
|