<commit_before>
require 'rest-core/middleware'

require 'cool.io-http'

class RestCore::Coolio
  include RestCore::Middleware
  def call env
    ::Coolio::Http.request(:url     => request_uri(env),
                           :payload => env[REQUEST_PAYLOAD],
                           :headers => env[REQUEST_HEADERS]){ |response|

      env[ASYNC].call(env.merge(RESPONSE_BODY    => response.body  ,
                                RESPONSE_STATUS  => response.status,
                                RESPONSE_HEADERS => response.headers))
    }

    env
  end
end<commit_msg>coolio.rb: only calls ASYNC if a block is passed<commit_after>
require 'rest-core/middleware'

require 'cool.io-http'

class RestCore::Coolio
  include RestCore::Middleware
  def call env
    ::Coolio::Http.request(:url     => request_uri(env),
                           :payload => env[REQUEST_PAYLOAD],
                           :headers => env[REQUEST_HEADERS]){ |response|

      if env[ASYNC]
        env[ASYNC].call(env.merge(RESPONSE_BODY    => response.body  ,
                                  RESPONSE_STATUS  => response.status,
                                  RESPONSE_HEADERS => response.headers))
      end
    }

    env
  end
end
{'fraction_non_alphanumeric': 0.10431947840260798, 'fraction_numerical': 0.0, 'mean_word_length': 1.8491879350348028, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1433783', 'n_tokens_mistral': 377, 'n_tokens_neox': 362, 'n_words': 66}