app.head.js
This file
Path
test/app.head.js
66 lines · 1.3 KiB · JavaScript
Last changed by
Revert "fix behavior of multiple app.VERB for the same path"Douglas Christopher Wilsonbefore adoption7f04916
History of this fileTake it
The walk stopped after 200 commits: lines older than 2e68ddb point at it.
expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
line 1why, one step back1remove unnecessary test/support/httpJonathan Ongbefore adoption643397e
lines 2–4why, one step back2var express = require('../');3var request = require('supertest');4var assert = require('assert');expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 5–18why, one step back56describe('HEAD', function(){7 it('should default to GET', function(done){8 var app = express();910 app.get('/tobi', function(req, res){11 // send() detects HEAD12 res.send('tobi');13 });1415 request(app)16 .head('/tobi')17 .expect(200, done);18 })Include ETag in HEAD requestsTiago Relvaobefore adoption3c7310e
lines 19–41why, one step back1920 it('should output the same headers as GET requests', function(done){21 var app = express();2223 app.get('/tobi', function(req, res){24 // send() detects HEAD25 res.send('tobi');26 });2728 request(app)29 .get('/tobi')30 .expect(200, function(err, res){31 if (err) return done(err);32 var headers = res.headers;33 request(app)34 .get('/tobi')35 .expect(200, function(err, res){36 if (err) return done(err);37 assert.deepEqual(res.headers, headers);38 done();39 });40 });41 })expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 42–44why, one step back42})4344describe('app.head()', function(){Revert "fix behavior of multiple app.VERB for the same path"Douglas Christopher Wilsonbefore adoption7f04916
line 45why, one step back45 it('should override', function(done){expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 46–66why, one step back46 var app = express()47 , called;4849 app.head('/tobi', function(req, res){50 called = true;51 res.end('');52 });5354 app.get('/tobi', function(req, res){55 assert(0, 'should not call GET');56 res.send('tobi');57 });5859 request(app)60 .head('/tobi')61 .expect(200, function(){62 assert(called);63 done();64 });65 })66})