class HTTParty::Request

def perform(&block)

def perform(&block)
  validate
  setup_raw_request
  chunked_body = nil
  current_http = http
  self.last_response = current_http.request(@raw_request) do |http_response|
    if block
      chunks = []
      http_response.read_body do |fragment|
        encoded_fragment = encode_text(fragment, http_response['content-type'])
        chunks << encoded_fragment if !options[:stream_body]
        block.call ResponseFragment.new(encoded_fragment, http_response, current_http)
      end
      chunked_body = chunks.join
    end
  end
  handle_host_redirection if response_redirects?
  result = handle_unauthorized
  result ||= handle_response(chunked_body, &block)
  result
end