app.head.js
This file
Path
test/app.head.js
68 lines · 1.4 KiB · JavaScript
Last changed by
Merge tag '3.13.0'Douglas Christopher Wilsonbefore adoptionbcee730
History of this fileTake it
The walk stopped after 200 commits: lines older than f41d09a point at it.
remove app.router and refactor middleware processingRoman Shtylmanbefore adoptionf41d09a
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');remove app.router and refactor middleware processingRoman Shtylmanbefore adoptionf41d09a
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–36why, 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);Merge tag '3.13.0'Douglas Christopher Wilsonbefore adoptionbcee730
lines 37–38why, one step back37 delete headers.date;38 delete res.headers.date;Include ETag in HEAD requestsTiago Relvaobefore adoption3c7310e
lines 39–43why, one step back39 assert.deepEqual(res.headers, headers);40 done();41 });42 });43 })remove app.router and refactor middleware processingRoman Shtylmanbefore adoptionf41d09a
lines 44–46why, one step back44})4546describe('app.head()', function(){Revert "fix behavior of multiple app.VERB for the same path"Douglas Christopher Wilsonbefore adoption7f04916
line 47why, one step back47 it('should override', function(done){remove app.router and refactor middleware processingRoman Shtylmanbefore adoptionf41d09a
lines 48–68why, one step back48 var app = express()49 , called;5051 app.head('/tobi', function(req, res){52 called = true;53 res.end('');54 });5556 app.get('/tobi', function(req, res){57 assert(0, 'should not call GET');58 res.send('tobi');59 });6061 request(app)62 .head('/tobi')63 .expect(200, function(){64 assert(called);65 done();66 });67 })68})