using the new TYPES

This commit is contained in:
Simon Martín 2019-02-28 11:49:05 +01:00
parent a97c25e914
commit 52e4dfa728
3 changed files with 11 additions and 6 deletions

View File

@ -45,7 +45,7 @@ JobController.prototype.route = function (app) {
bodyParserMiddleware(),
checkBodyPayloadSize(),
handleQueryMiddleware(true),
logMiddleware(),
logMiddleware(logMiddleware.TYPES.JOB),
jobMiddlewares('create', createJob, RATE_LIMIT_ENDPOINTS_GROUPS.JOB_CREATE)
);
app.get(

View File

@ -47,7 +47,7 @@ QueryController.prototype.route = function (app) {
connectionParamsMiddleware(this.userDatabaseService),
timeoutLimitsMiddleware(this.metadataBackend),
handleQueryMiddleware(),
logMiddleware(),
logMiddleware(logMiddleware.TYPES.QUERY),
this.handleQuery.bind(this),
errorMiddleware()
];

View File

@ -6,6 +6,7 @@ const server = require('../../app/server')();
const assert = require('../support/assert');
const qs = require('querystring');
const BatchTestClient = require('../support/batch-test-client');
const { TYPES } = require('../../app/middlewares/log');
const QUERY = `SELECT 14 as foo`;
const API_KEY = 1234;
@ -73,7 +74,8 @@ describe('Log middleware', function() {
assert.deepEqual(log, {
request: {
sql: {
simple: QUERY
type: TYPES.QUERY,
sql: QUERY
}
}
});
@ -104,7 +106,8 @@ describe('Log middleware', function() {
assert.deepEqual(log, {
request: {
sql: {
simple: QUERY
type: TYPES.JOB,
sql: QUERY
}
}
});
@ -123,7 +126,8 @@ describe('Log middleware', function() {
assert.deepEqual(log, {
request: {
sql: {
multiple: [QUERY, QUERY]
type: TYPES.JOB,
sql: [QUERY, QUERY]
}
}
});
@ -202,7 +206,8 @@ describe('Log middleware', function() {
assert.deepEqual(log, {
request: {
sql: {
simple: QUERY.substring(0, global.settings.maxQueriesLogLength)
type: TYPES.QUERY.substring(0, global.settings.maxQueriesLogLength),
sql: QUERY.substring(0, global.settings.maxQueriesLogLength)
}
}
});