<commit_before>
(function(){
  Express = { 
    version : '0.0.1',
    routes  : [],
    
    // --- Response
    
    response : {
      body : null,
      status : 200,
      headers : {},
      cookie : {}
    },
    
    // --- Defaults
    
    defaults : {
      cookie : {
        maxAge : 3600
      },
      route : {
        callback : function() {
          Express.status('Not Found')
          'Not Found'
        }
      }
    },
    
    hookCallbacks : {
      request : [
        
        // Headers hash
        
        function (request, response) {
          Express.request = request
          request.headers = Express.arrayToHash(request.headers)
        },
        
        // Cookie parsing
        
        function (request, response) {
          Express.response.cookie = request.cookie = Express.parseCookie(request.headers['Cookie'])
        }
      ]
    },
    
    hook : function(name) {
      for (var name in this.hookCallbacks)
        if (this.hookCallbacks.hasOwnProperty(name))
          for (i = 0, len = this.hookCallbacks[name].length; i < len; ++i)
            this.hookCallbacks[name][i].apply(this, this.argsArray(arguments, 1))
    },
    
    /**
     * Start express, binding to _port_.
     *
     * @param {int} port
     * @api public
     */
    
    start : function(port) {
      this.server.listen(port || 3000, function(request, response){
        Express.hook('request', request, response)
        request.uri.params = Express.parseNestedParams(request.uri.params)
        request.uri.path = Express.normalizePath(request.uri.path)
        Express.response.body = Express.callRouteFor(request)
        Express.prepareCookie()
        Express.hook('response')
        response.sendHeader(Express.response.status, Express.hashToArray(Express.response.headers))<commit_msg>Fixed hook()<commit_after>
(function(){
  Express = { 
    version : '0.0.1',
    routes  : [],
    
    // --- Response
    
    response : {
      body : null,
      status : 200,
      headers : {},
      cookie : {}
    },
    
    // --- Defaults
    
    defaults : {
      cookie : {
        maxAge : 3600
      },
      route : {
        callback : function() {
          Express.status('Not Found')
          'Not Found'
        }
      }
    },
    
    hookCallbacks : {
      request : [
        
        // Headers hash
        
        function (request, response) {
          Express.request = request
          request.headers = Express.arrayToHash(request.headers)
        },
        
        // Cookie parsing
        
        function (request, response) {
          Express.response.cookie = request.cookie = Express.parseCookie(request.headers['Cookie'])
        }
      ],
      
      response : [
        function() {
          
        }
      ]
    },
    
    hook : function(name) {
      if (this.hookCallbacks[name])
        for (i = 0, len = this.hookCallbacks[name].length; i < len; ++i)
          this.hookCallbacks[name][i].apply(this, this.argsArray(arguments, 1))
    },
    
    /**
     * Start express, binding to _port_.
     *
     * @param {int} port
     * @api public
     */
    
    start : function(port) {
      this.server.listen(port || 3000, function(request, response){
        Express.hook('request', request, response)
        request.uri.params = Express.parseNestedParams(request.uri.params)
        request.uri.path = Express.normalizePath(request.uri.path)
        Express.response.body = Express.callRouteFor(request)
        Express.prepareCookie()
        Express.hook('response')
        response.sendHeader(Express.response.status, Express.hashToArray(Express.response.headers))
{'fraction_non_alphanumeric': 0.12697547683923704, 'fraction_numerical': 0.008719346049046322, 'mean_word_length': 1.7072271386430677, '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': '6468743', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1043, 'n_words': 185}