<commit_before>var request = require('request'),
    signer = require('./request-signer'),
    AmazonError = require('./amazon-error'),
    URL = require('url'),
    STS = require('./sts').STS;

var defaults = {
  prefix : "DynamoDB_20111205.",
  host : "dynamodb.us-east-1.amazonaws.com"
};

var Request = exports.Request = function Request(config) {
  this.config = config;
  this.sts = new STS(config);
};

Request.prototype.send = function(action, options, cb) {
  this.sts.getSessionToken(function(err, credentials) {
    if(err) return cb(err);

    var headers = {
      "host" : defaults.host,
      "x-amz-date" : new Date().toGMTString(),
      "x-amz-security-token" : credentials.sessionToken,
      "x-amz-target" : defaults.prefix + action,
      "content-type" : "application/x-amz-json-1.0"
    };

    var signedHeaders = signer.sign(headers, options, credentials);

    request({
      method : "POST",
      headers : signedHeaders,
      url : URL.format({host:defaults.host, protocol: "https"}),
      body : JSON.stringify(options),
    }, function(err, resp, body) {
      if(err) return cb(err);

      var json = JSON.parse(body);
      if(resp.statusCode != 200) {
        return cb(new AmazonError({type : json["__type"], message: json["message"], statusCode: resp.statusCode}));
      }

      return cb(null, json);
    });
  });

}<commit_msg>adding in defaults to request<commit_after>var request = require('request'),
    _ = require("underscore"),
    signer = require('./request-signer'),
    AmazonError = require('./amazon-error'),
    URL = require('url'),
    STS = require('./sts').STS;

var Request = exports.Request = function Request(config) {
  this.sts = new STS(config);

  this.config = _.defaults(config, {
    prefix : "DynamoDB_20111205.",
    host : "dynamodb.us-east-1.amazonaws.com"
  });
};

Request.prototype.send = function(action, options, cb) {
  var self = this;

  this.sts.getSessionToken(function(err, credentials) {
    if(err) return cb(err);

    var headers = {
      "host" : self.config.host,
      "x-amz-date" : new Date().toGMTString(),
      "x-amz-security-token" : credentials.sessionToken,
      "x-amz-target" : self.config.prefix + action,
      "content-type" : "application/x-amz-json-1.0"
    };

    var signedHeaders = signer.sign(headers, options, credentials);

    request({
      method : "POST",
      headers : signedHeaders,
      url : URL.format({host:self.config.host, protocol: "https"}),
      body : JSON.stringify(options),
    }, function(err, resp, body) {
      if(err) return cb(err);

      var json = JSON.parse(body);
      if(resp.statusCode != 200) {
        return cb(new AmazonError({type : json["__type"], message: json["message"], statusCode: resp.statusCode}));
      }

      return cb(null, json);
    });
  });

}
{'fraction_non_alphanumeric': 0.168141592920354, 'fraction_numerical': 0.00991150442477876, 'mean_word_length': 3.0838150289017343, 'pattern_counts': {'":': 0, '<': 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': '6052837', 'n_tokens_mistral': 935, 'n_tokens_neox': 898, 'n_words': 182}