<commit_before>require 'faraday'

conn = Faraday.new(:url => ENV['BUILD_API_SERVER_URL']) do |faraday|
  faraday.response :logger
  faraday.adapter Faraday.default_adapter
end

# data = eval DATA.read

conn.post do |req|
  req.url '/script'
  req.headers['Content-Type'] = 'application/json'
  req.headers['Authorization'] = "token #{ENV['API_TOKEN']}"

  req.body = DATA.read
end

__END__
{"type"=>"test",
 "build"=>
  {"id"=>21311478,
   "number"=>"4072.2",
   "commit"=>"<PASSWORD>",
   "commit_range"=>"068bdd62c92c...6d7ffb15a816",
   "commit_message"=>"[Truffle] Annotate specs that also fail in JRuby.",
   "branch"=>"master",<commit_msg>Use JSON for payload<commit_after>require 'faraday'
require 'json'

conn = Faraday.new(:url => ENV['BUILD_API_SERVER_URL']) do |faraday|
  faraday.response :logger
  faraday.adapter Faraday.default_adapter
end

data = eval DATA.read

conn.post do |req|
  req.url '/script'
  req.headers['Content-Type'] = 'application/json'
  req.headers['Authorization'] = "token #{ENV['API_TOKEN']}"

  req.body = data.to_json
end

__END__
{"type"=>"test",
 "build"=>
  {"id"=>21311478,
   "number"=>"4072.2",
   "commit"=>"<PASSWORD>",
   "commit_range"=>"068bdd62c92c...6d7ffb15a816",
   "commit_message"=>"[Truffle] Annotate specs that also fail in JRuby.",
   "branch"=>"master",
{'fraction_non_alphanumeric': 0.1865955826351866, 'fraction_numerical': 0.04112718964204113, 'mean_word_length': 5.169014084507042, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6389584', 'n_tokens_mistral': 550, 'n_tokens_neox': 501, 'n_words': 92}