class Kickbox::HttpClient::ResponseHandler

ResponseHandler takes care of decoding the response body into suitable type

Public Class Methods

get_body(env) click to toggle source
# File lib/kickbox/http_client/response_handler.rb, line 8
def self.get_body(env)
  type = env.response_headers["content-type"] || ''
  body = env.body

  # Response body is in JSON
  if type.include?("json")
    body = JSON.parse body
  end

  return body
end