Method: HttpHelper.response_check

Defined in:
lib/unit/utils/http_helper.rb

.response_check(response, response_type = nil) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/unit/utils/http_helper.rb', line 45

def self.response_check(response, response_type = nil)
  if RESPONSE_TYPES.include?(response_type) || response.body.include?("html") || response.body.include?("PDF")
    response.body
  else
    JSON.parse(response.body)
  end
end