<commit_before>
describe 'Express'
  before_each
    reset()
    use(require('express/plugins/hooks').Hooks)
  end
  
  describe 'Hooks'
    describe 'before()'
      it 'should be called before every request'
        GLOBAL.before(function(){
          this.response.body = 'foo'
        })
        GLOBAL.before(function(){
          this.response.body += 'bar'
        })
        get('/user', function(){})
        get('/user').body.should.eql 'foobar'
      end
    end
    
    describe 'after()'
      it 'should be called after every request'
        var body
        GLOBAL.after(function(){<commit_msg>Added failing before() hook halt spec<commit_after>
describe 'Express'
  before_each
    reset()
    use(require('express/plugins/hooks').Hooks)
  end
  
  describe 'Hooks'
    describe 'before()'
      it 'should be called before every request'
        GLOBAL.before(function(){
          this.response.body = 'foo'
        })
        GLOBAL.before(function(){
          this.response.body += 'bar'
        })
        get('/user', function(){})
        get('/user').body.should.eql 'foobar'
      end
      
      it 'should be able to halt the request'
        GLOBAL.before(function(){
          this.halt(404, 'woo!')
        })
        get('/user', function(){ return 'fail' })
        get('/user').status.should.eql 404
        get('/user').body.should.eql 'woo!'
      end
    end
    
    describe 'after()'
      it 'should be called after every request'
        var body
        GLOBAL.after(function(){
{'fraction_non_alphanumeric': 0.13713910761154854, 'fraction_numerical': 0.003937007874015748, 'mean_word_length': 2.05, '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': '6857095', 'n_tokens_mistral': 454, 'n_tokens_neox': 446, 'n_words': 108}