mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
44 lines
814 B
JavaScript
44 lines
814 B
JavaScript
|
|
var express = require('../')
|
|
, request = require('./support/http')
|
|
, assert = require('assert');
|
|
|
|
describe('HEAD', function(){
|
|
it('should default to GET', function(done){
|
|
var app = express();
|
|
|
|
app.get('/tobi', function(req, res){
|
|
// send() detects HEAD
|
|
res.send('tobi');
|
|
});
|
|
|
|
request(app)
|
|
.head('/tobi')
|
|
.expect(200, done);
|
|
})
|
|
})
|
|
|
|
describe('app.head()', function(){
|
|
it('should override', function(done){
|
|
var app = express()
|
|
, called;
|
|
|
|
app.head('/tobi', function(req, res){
|
|
called = true;
|
|
res.end('');
|
|
});
|
|
|
|
app.get('/tobi', function(req, res){
|
|
assert(0, 'should not call GET');
|
|
res.send('tobi');
|
|
});
|
|
|
|
request(app)
|
|
.head('/tobi')
|
|
.expect(200, function(){
|
|
assert(called);
|
|
done();
|
|
});
|
|
})
|
|
})
|