2018-10-24 00:39:02 +08:00
|
|
|
'use strict';
|
|
|
|
|
2019-10-07 17:29:07 +08:00
|
|
|
require('../support/test-helper');
|
2015-09-17 18:48:29 +08:00
|
|
|
|
|
|
|
var assert = require('assert');
|
|
|
|
|
2019-10-07 17:29:07 +08:00
|
|
|
var errorMiddleware = require('../../lib/api/middlewares/error-middleware');
|
2015-09-17 18:48:29 +08:00
|
|
|
|
2019-10-22 01:07:24 +08:00
|
|
|
describe('error messages clean up', function () {
|
2015-09-17 18:48:29 +08:00
|
|
|
// See https://github.com/CartoDB/Windshaft/issues/173
|
2019-10-22 01:07:24 +08:00
|
|
|
it('#173 does not send db details in connection error response', function () {
|
2015-09-17 18:48:29 +08:00
|
|
|
var inMessage = [
|
2019-10-22 01:07:24 +08:00
|
|
|
'Postgis Plugin: Bad connection',
|
2015-09-17 18:48:29 +08:00
|
|
|
"Connection string: 'host=127.0.0.1 port=5432 dbname=test_windshaft_cartodb_user_1_db " +
|
|
|
|
"user=test_windshaft_cartodb_user_1 connect_timeout=4'",
|
|
|
|
" encountered during parsing of layer 'layer0' in Layer"
|
|
|
|
].join('\n');
|
|
|
|
|
2017-09-21 17:46:31 +08:00
|
|
|
var outMessage = errorMiddleware.errorMessage(inMessage);
|
2015-09-17 18:48:29 +08:00
|
|
|
|
|
|
|
assert.ok(outMessage.match('connect'), outMessage);
|
|
|
|
assert.ok(!outMessage.match(/666/), outMessage);
|
|
|
|
});
|
|
|
|
});
|