No 'json spaces' by default
Json rendering can be handled by user tools or overridden in their own app to behave as desired. Minimizes the use of magic env settings.
Esse commit está contido em:
@@ -82,10 +82,6 @@ app.defaultConfiguration = function(){
|
||||
this.set('views', process.cwd() + '/views');
|
||||
this.set('jsonp callback name', 'callback');
|
||||
|
||||
this.configure('development', function(){
|
||||
this.set('json spaces', 2);
|
||||
});
|
||||
|
||||
if (this.get('env') === 'production') {
|
||||
this.enable('view cache');
|
||||
};
|
||||
|
||||
+3
-10
@@ -52,7 +52,7 @@ describe('res', function(){
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
describe('when given an object', function(){
|
||||
it('should respond with json', function(done){
|
||||
var app = express();
|
||||
@@ -95,14 +95,7 @@ describe('res', function(){
|
||||
})
|
||||
|
||||
describe('"json spaces" setting', function(){
|
||||
it('should default to 2 in development', function(){
|
||||
process.env.NODE_ENV = 'development';
|
||||
var app = express();
|
||||
app.get('json spaces').should.equal(2);
|
||||
process.env.NODE_ENV = 'test';
|
||||
})
|
||||
|
||||
it('should be undefined otherwise', function(){
|
||||
it('should be undefined by default', function(){
|
||||
var app = express();
|
||||
assert(undefined === app.get('json spaces'));
|
||||
})
|
||||
@@ -125,7 +118,7 @@ describe('res', function(){
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
describe('.json(status, object)', function(){
|
||||
it('should respond with json and set the .statusCode', function(done){
|
||||
var app = express();
|
||||
|
||||
+1
-8
@@ -181,14 +181,7 @@ describe('res', function(){
|
||||
})
|
||||
|
||||
describe('"json spaces" setting', function(){
|
||||
it('should default to 2 in development', function(){
|
||||
process.env.NODE_ENV = 'development';
|
||||
var app = express();
|
||||
app.get('json spaces').should.equal(2);
|
||||
process.env.NODE_ENV = 'test';
|
||||
})
|
||||
|
||||
it('should be undefined otherwise', function(){
|
||||
it('should be undefined by default', function(){
|
||||
var app = express();
|
||||
assert(undefined === app.get('json spaces'));
|
||||
})
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário