mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
parent
61f2929a35
commit
3c7310ebcb
|
|
@ -130,7 +130,7 @@ res.send = function(body){
|
|||
|
||||
// ETag support
|
||||
// TODO: W/ support
|
||||
if (app.settings.etag && len && 'GET' == req.method) {
|
||||
if (app.settings.etag && len && ('GET' == req.method || 'HEAD' == req.method)) {
|
||||
if (!this.get('ETag')) {
|
||||
this.set('ETag', etag(body));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,29 @@ describe('HEAD', function(){
|
|||
.head('/tobi')
|
||||
.expect(200, done);
|
||||
})
|
||||
|
||||
it('should output the same headers as GET requests', function(done){
|
||||
var app = express();
|
||||
|
||||
app.get('/tobi', function(req, res){
|
||||
// send() detects HEAD
|
||||
res.send('tobi');
|
||||
});
|
||||
|
||||
request(app)
|
||||
.get('/tobi')
|
||||
.expect(200, function(err, res){
|
||||
if (err) return done(err);
|
||||
var headers = res.headers;
|
||||
request(app)
|
||||
.get('/tobi')
|
||||
.expect(200, function(err, res){
|
||||
if (err) return done(err);
|
||||
assert.deepEqual(res.headers, headers);
|
||||
done();
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
describe('app.head()', function(){
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user