_validateAndClean actually accepts param now

This commit is contained in:
jens 2017-02-07 11:20:10 +01:00
parent bc296b9dc5
commit 0913e08910

View file

@ -53,20 +53,19 @@ export default class Exposure {
this.initCountMethod(); this.initCountMethod();
} }
_validateAndClean() { _validateAndClean(config) {
if (typeof(this.config) === 'function') { if (typeof(config) === 'function') {
const firewall = this.config; const firewall = config;
this.config = {firewall}; config = {firewall};
}
config = ExposureConfigSchema.clean(config);
ExposureConfigSchema.validate(config);
if (config && config.body) {
ExposureConfigSchema.validateBody(this.collection, config.body);
} }
this.config = ExposureConfigSchema.clean(this.config); return _.extend({}, Exposure.getConfig(), config);
ExposureConfigSchema.validate(this.config);
if (this.config && this.config.body) {
ExposureConfigSchema.validateBody(this.collection, this.config.body);
}
return _.extend({}, Exposure.getConfig(), this.config);
} }
/** /**
@ -207,4 +206,4 @@ export default class Exposure {
return findOne(filters, options); return findOne(filters, options);
} }
} }
}; };