Only parser JSON from body when needed
This commit is contained in:
parent
9429006ee4
commit
9b9c6f168a
@ -140,8 +140,6 @@ app._checkKey = function(key, ip, cb) {
|
||||
app._initializeHTTP = function() {
|
||||
var self = this;
|
||||
|
||||
this.use(bodyParser.urlencoded({extended: true}));
|
||||
this.use(bodyParser.json());
|
||||
this.use(util.allowCrossDomain);
|
||||
|
||||
// Retrieve guaranteed random ID.
|
||||
@ -219,13 +217,15 @@ app._initializeHTTP = function() {
|
||||
}
|
||||
};
|
||||
|
||||
this.post('/:key/:id/:token/offer', handle);
|
||||
var jsonParser = bodyParser.json();
|
||||
|
||||
this.post('/:key/:id/:token/candidate', handle);
|
||||
this.post('/:key/:id/:token/offer', jsonParser, handle);
|
||||
|
||||
this.post('/:key/:id/:token/answer', handle);
|
||||
this.post('/:key/:id/:token/candidate', jsonParser, handle);
|
||||
|
||||
this.post('/:key/:id/:token/leave', handle);
|
||||
this.post('/:key/:id/:token/answer', jsonParser, handle);
|
||||
|
||||
this.post('/:key/:id/:token/leave', jsonParser, handle);
|
||||
};
|
||||
|
||||
/** Saves a streaming response and takes care of timeouts and headers. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user