<commit_before>
const util = require('util');
const Writable = require('stream').Writable;

function OutgoingResponse(req) {
  Writable.call(this);

  this.socket = req.socket;
}
util.inherits(OutgoingResponse, Writable);


module.exports = OutgoingResponse;<commit_msg>:sparkles: add OutgoingMessage prototype methods<commit_after>
const util = require('util');
const Writable = require('stream').Writable;

function OutgoingResponse(req) {
  Writable.call(this);

  this.socket = req.socket;
  this._headers = {};

  this.finished = false;
}
util.inherits(OutgoingResponse, Writable);

OutgoingResponse.prototype.setHeader = function (name, value) {
  // TODO check name and value 
  var key = name.toLowerCase();
  this._headers[key] = value;
}

OutgoingResponse.prototype.getHeader = function (name) {
  if (arguments.length < 1) {
    throw new Error('"name" argument is required for getHeader(name)');
  }

  var key = name.toLowerCase();
  return this._headers[key];
}

OutgoingResponse.prototype.write = function (chunk, encoding, callback) {
  return this.socket.write(chunk, encoding, callback);
}

OutgoingResponse.prototype.end = function (chunk, encoding, callback) {
  this.finished = true;
  this.socket.end(data, encoding);
}

module.exports = OutgoingResponse;
{'fraction_non_alphanumeric': 0.1307752545027408, 'fraction_numerical': 0.0007830853563038371, 'mean_word_length': 5.144230769230769, 'pattern_counts': {'":': 0, '<': 4, '<?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': '1726971', 'n_tokens_mistral': 390, 'n_tokens_neox': 384, 'n_words': 89}