case sensitivity test
Esse commit está contido em:
+1
-2
@@ -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();
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário