<commit_before>require 'sinatra/base'

class SinatraApp < Sinatra::Base
  use BatchApi::Middleware

  def get
    headers["GET"] = "hello"
    # including this in the body would mess the body up
    # due to the other headers inserted
    headers["REQUEST_HEADERS"] = header_output
    content_type :json

    status 422
    {
      result: "GET OK",
      params: params.delete(:endpoint)
    }
  end

  def post
    headers["POST"] = "guten tag"
    headers["REQUEST_HEADERS"] = header_output
    content_type :json
    status 203
    {
      result: "POST OK",
      params: params.delete(:endpoint)<commit_msg>Configure Sinatra app to parse JSON<commit_after>require 'sinatra/base'
require 'rack/contrib'

class SinatraApp < Sinatra::Base
  use Rack::PostBodyContentTypeParser
  use BatchApi::Middleware

  def get
    headers["GET"] = "hello"
    # including this in the body would mess the body up
    # due to the other headers inserted
    headers["REQUEST_HEADERS"] = header_output
    content_type :json

    status 422
    {
      result: "GET OK",
      params: params.delete(:endpoint)
    }
  end

  def post
    headers["POST"] = "guten tag"
    headers["REQUEST_HEADERS"] = header_output
    content_type :json
    status 203
    {
      result: "POST OK",
      params: params.delete(:endpoint)
{'fraction_non_alphanumeric': 0.09534706331045004, 'fraction_numerical': 0.009153318077803204, 'mean_word_length': 3.0619195046439627, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '1525000', 'n_tokens_mistral': 409, 'n_tokens_neox': 390, 'n_words': 118}