Add test for `remoting.rest.supportedTypes`

This commit is contained in:
Miroslav Bajtoš 2014-10-31 10:36:59 +01:00
parent 2d0b74b007
commit ead9d706e6
1 changed files with 16 additions and 0 deletions

View File

@ -75,6 +75,22 @@ describe('loopback.rest', function() {
});
});
it('should honour `remoting.rest.supportedTypes`', function(done) {
var app = loopback();
// NOTE it is crucial to set `remoting` before creating any models
var supportedTypes = ['json', 'application/javascript', 'text/javascript'];
app.set('remoting', { rest: { supportedTypes: supportedTypes } });
app.model(MyModel);
app.use(loopback.rest());
request(app).get('/mymodels')
.set('Accept', 'text/html,application/xml;q=0.9,*/*;q=0.8')
.expect('Content-Type', 'application/json; charset=utf-8')
.expect(200, done);
});
it('includes loopback.token when necessary', function(done) {
givenUserModelWithAuth();
app.enableAuth();