Skip to content

Commit

Permalink
Faraday expects a status line. Fixes #574
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Brasero committed Aug 11, 2017
1 parent 702ce8c commit 37b2db5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/typhoeus/response/informations.rb
Expand Up @@ -47,9 +47,11 @@ def response_body
def response_headers
return options[:response_headers] if options[:response_headers]
if mock? && h = options[:headers]
h.map{ |k,v| [k, v.respond_to?(:join) ? v.join(',') : v] }.
map{ |e| "#{e.first}: #{e.last}" }.
join("\r\n")
status_line = "HTTP/1.1 #{return_code} Mock Reason Phrase"
actual_headers = h.map{ |k,v| [k, v.respond_to?(:join) ? v.join(',') : v] }.
map{ |e| "#{e.first}: #{e.last}" }

[status_line, *actual_headers].join("\r\n")
end
end

Expand Down

0 comments on commit 37b2db5

Please sign in to comment.