moving body-parser from global to routes of query and job
This commit is contained in:
parent
0346cf11d8
commit
02238fefe1
@ -1,5 +1,6 @@
|
||||
const util = require('util');
|
||||
|
||||
const bodyParserMiddleware = require('../middlewares/body-parser');
|
||||
const userMiddleware = require('../middlewares/user');
|
||||
const { initializeProfilerMiddleware, finishProfilerMiddleware } = require('../middlewares/profiler');
|
||||
const authorizationMiddleware = require('../middlewares/authorization');
|
||||
@ -30,21 +31,25 @@ JobController.prototype.route = function (app) {
|
||||
|
||||
app.get(
|
||||
`${base_url}/jobs-wip`,
|
||||
bodyParserMiddleware(),
|
||||
listWorkInProgressJobs(this.jobService),
|
||||
sendResponse(),
|
||||
errorMiddleware()
|
||||
);
|
||||
app.post(
|
||||
`${base_url}/sql/job`,
|
||||
bodyParserMiddleware(),
|
||||
checkBodyPayloadSize(),
|
||||
jobMiddlewares('create', createJob, RATE_LIMIT_ENDPOINTS_GROUPS.JOB_CREATE)
|
||||
);
|
||||
app.get(
|
||||
`${base_url}/sql/job/:job_id`,
|
||||
bodyParserMiddleware(),
|
||||
jobMiddlewares('retrieve', getJob, RATE_LIMIT_ENDPOINTS_GROUPS.JOB_GET)
|
||||
);
|
||||
app.delete(
|
||||
`${base_url}/sql/job/:job_id`,
|
||||
bodyParserMiddleware(),
|
||||
jobMiddlewares('cancel', cancelJob, RATE_LIMIT_ENDPOINTS_GROUPS.JOB_DELETE)
|
||||
);
|
||||
};
|
||||
|
@ -12,6 +12,7 @@ var formats = require('../models/formats');
|
||||
|
||||
var sanitize_filename = require('../utils/filename_sanitizer');
|
||||
var getContentDisposition = require('../utils/content_disposition');
|
||||
const bodyParserMiddleware = require('../middlewares/body-parser');
|
||||
const userMiddleware = require('../middlewares/user');
|
||||
const errorMiddleware = require('../middlewares/error');
|
||||
const authorizationMiddleware = require('../middlewares/authorization');
|
||||
@ -35,6 +36,7 @@ QueryController.prototype.route = function (app) {
|
||||
const { base_url } = global.settings;
|
||||
const queryMiddlewares = endpointGroup => {
|
||||
return [
|
||||
bodyParserMiddleware(),
|
||||
initializeProfilerMiddleware('query'),
|
||||
userMiddleware(),
|
||||
rateLimitsMiddleware(this.userLimitsService, endpointGroup),
|
||||
|
@ -15,7 +15,6 @@
|
||||
//
|
||||
|
||||
var express = require('express');
|
||||
var bodyParser = require('./middlewares/body-parser');
|
||||
var Profiler = require('./stats/profiler-proxy');
|
||||
var _ = require('underscore');
|
||||
var TableCacheFactory = require('./utils/table_cache_factory');
|
||||
@ -128,7 +127,6 @@ function App(statsClient) {
|
||||
});
|
||||
}
|
||||
|
||||
app.use(bodyParser());
|
||||
app.enable('jsonp callback');
|
||||
app.set("trust proxy", true);
|
||||
app.disable('x-powered-by');
|
||||
|
Loading…
Reference in New Issue
Block a user