mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
case sensitivity test
This commit is contained in:
parent
af46df7eae
commit
1a5636b199
|
|
@ -368,6 +368,5 @@ req.__defineGetter__('stale', function(){
|
|||
*/
|
||||
|
||||
req.__defineGetter__('xhr', function(){
|
||||
return this.header('X-Requested-With', '')
|
||||
.toLowerCase() == 'xmlhttprequest';
|
||||
return 'xmlhttprequest' == this.header('X-Requested-With', '').toLowerCase();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -20,6 +20,22 @@ describe('req', function(){
|
|||
})
|
||||
})
|
||||
|
||||
it('should case-insensitive', function(done){
|
||||
var app = express();
|
||||
|
||||
app.use(function(req, res){
|
||||
req.xhr.should.be.true;
|
||||
res.end();
|
||||
});
|
||||
|
||||
request(app)
|
||||
.get('/')
|
||||
.set('X-Requested-With', 'XMLHttpRequest')
|
||||
.end(function(res){
|
||||
done();
|
||||
})
|
||||
})
|
||||
|
||||
it('should return false otherwise', function(done){
|
||||
var app = express();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user