module HttpTest::HttpMethods::Response
Public Class Methods
create(faraday_response)
click to toggle source
# File lib/http-test/http_methods.rb, line 30 def self.create(faraday_response) body, headers = faraday_response.body, faraday_response.headers return BlankResponse.new(faraday_response) unless body && body.length > 0 response = case content_type = headers["content-type"] when /\Aapplication\/json/ then JSON.parse faraday_response.body when /\Atext\// then faraday_response.body else raise "unsupported content_type: #{content_type.inspect}" end response.extend FaradayHelper response.faraday_response = faraday_response response end