<commit_before>var http   = require("http")
  , crypto = require("crypto")

function Request(target, data) {
  var headers = this.headers = new Headers

  this.json = JSON.stringify(data)

  headers["x-amz-target"] = Request.prototype.target + target
  headers["Host"] = this.host
  headers["Content-Length"] = Buffer.byteLength(this.json)
}

Request.prototype = {
  method:   "POST",
  host:     "dynamodb.us-east-1.amazonaws.com",
  pathname: "/",
  target:   "DynamoDB_20111205.",
  data:     {},

  toString: function() {
    return this.method +
      "\n" + this.pathname +
      "\n" + 
      "\n" + this.headers +
      "\n" +
      "\n" + this.json
  },

  send: function(cb) {
    var request = http.request(this, function(res) {
      var json = ""
      
      res.on("data", function(chunk){ json += chunk })
      res.on("end", function() {
        var response = JSON.parse(json)

        if (res.statusCode == 200) cb(null, response)

        else cb(new Error(response.__type + ": " + response.message))
      })
    })

    request.on("error", cb)

    request.write(this.json)
    request.end()
  }
}

function Headers() {
  this["x-amz-date"] = this["Date"] = (new Date).toUTCString()
  this["Content-Type"] = Headers.prototype["Content-Type"]
}

Headers.prototype = {
  "Content-Type": "application/x-amz-json-1.0",

  toString: function() {
    return "host:"                 + this["Host"] +
         "\nx-amz-date:"           + this["x-amz-date"] +<commit_msg>pass status code in error<commit_after>var http   = require("http")
  , crypto = require("crypto")

function Request(target, data) {
  var headers = this.headers = new Headers

  this.json = JSON.stringify(data)

  headers["x-amz-target"] = Request.prototype.target + target
  headers["Host"] = this.host
  headers["Content-Length"] = Buffer.byteLength(this.json)
}

Request.prototype = {
  method:   "POST",
  host:     "dynamodb.us-east-1.amazonaws.com",
  pathname: "/",
  target:   "DynamoDB_20111205.",
  data:     {},

  toString: function() {
    return this.method +
      "\n" + this.pathname +
      "\n" + 
      "\n" + this.headers +
      "\n" +
      "\n" + this.json
  },

  send: function(cb) {
    var request = http.request(this, function(res) {
      var json = ""
      
      res.on("data", function(chunk){ json += chunk })
      res.on("end", function() {
        var error, response = JSON.parse(json)

        if (res.statusCode == 200) return cb(null, response)

        error = new Error
        error.name = response.__type
        error.message = response.message
        error.statusCode = res.statusCode
        
        cb(error)
      })
    })

    request.on("error", cb)

    request.write(this.json)
    request.end()
  }
}

function Headers() {
  this["x-amz-date"] = this["Date"] = (new Date).toUTCString()
  this["Content-Type"] = Headers.prototype["Content-Type"]
}

Headers.prototype = {
  "Content-Type": "application/x-amz-json-1.0",

  toString: function() {
    return "host:"                 + this["Host"] +
         "\nx-amz-date:"           + this["x-amz-date"] +
{'fraction_non_alphanumeric': 0.17307071359380044, 'fraction_numerical': 0.009041007426541814, 'mean_word_length': 2.4730941704035874, 'pattern_counts': {'":': 3, '<': 3, '<?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': '711639', 'n_tokens_mistral': 1062, 'n_tokens_neox': 1025, 'n_words': 194}