mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 00:19:48 +01:00
Remove req.acceptsCharset
This commit is contained in:
parent
be35e4927c
commit
7f2532808a
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
* remove:
|
||||
- `app.del` - use `app.delete`
|
||||
- `req.acceptsCharset` - use `req.acceptsCharsets`
|
||||
- `res.json(obj, status)` signature - use `res.json(status, obj)`
|
||||
- `res.jsonp(obj, status)` signature - use `res.jsonp(status, obj)`
|
||||
- `res.send(body, status)` signature - use `res.send(status, body)`
|
||||
|
|
|
|||
|
|
@ -137,9 +137,6 @@ req.acceptsCharsets = function(){
|
|||
return accept.charsets.apply(accept, arguments);
|
||||
};
|
||||
|
||||
req.acceptsCharset = deprecate.function(req.acceptsCharsets,
|
||||
'req.acceptsCharset: Use acceptsCharsets instead');
|
||||
|
||||
/**
|
||||
* Check if the given `lang`s are acceptable,
|
||||
* otherwise you should respond with 406 "Not Acceptable".
|
||||
|
|
|
|||
|
|
@ -1,49 +0,0 @@
|
|||
|
||||
var express = require('../')
|
||||
, request = require('supertest');
|
||||
|
||||
describe('req', function(){
|
||||
describe('.acceptsCharset(type)', function(){
|
||||
describe('when Accept-Charset is not present', function(){
|
||||
it('should return true', function(done){
|
||||
var app = express();
|
||||
|
||||
app.use(function(req, res, next){
|
||||
res.end(req.acceptsCharset('utf-8') ? 'yes' : 'no');
|
||||
});
|
||||
|
||||
request(app)
|
||||
.get('/')
|
||||
.expect('yes', done);
|
||||
})
|
||||
})
|
||||
|
||||
describe('when Accept-Charset is not present', function(){
|
||||
it('should return true when present', function(done){
|
||||
var app = express();
|
||||
|
||||
app.use(function(req, res, next){
|
||||
res.end(req.acceptsCharset('utf-8') ? 'yes' : 'no');
|
||||
});
|
||||
|
||||
request(app)
|
||||
.get('/')
|
||||
.set('Accept-Charset', 'foo, bar, utf-8')
|
||||
.expect('yes', done);
|
||||
})
|
||||
|
||||
it('should return false otherwise', function(done){
|
||||
var app = express();
|
||||
|
||||
app.use(function(req, res, next){
|
||||
res.end(req.acceptsCharset('utf-8') ? 'yes' : 'no');
|
||||
});
|
||||
|
||||
request(app)
|
||||
.get('/')
|
||||
.set('Accept-Charset', 'foo, bar')
|
||||
.expect('no', done);
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
Reference in New Issue
Block a user