_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();
}
_validateAndClean() {
if (typeof(this.config) === 'function') {
const firewall = this.config;
this.config = {firewall};
_validateAndClean(config) {
if (typeof(config) === 'function') {
const firewall = config;
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);
ExposureConfigSchema.validate(this.config);
if (this.config && this.config.body) {
ExposureConfigSchema.validateBody(this.collection, this.config.body);
}
return _.extend({}, Exposure.getConfig(), this.config);
return _.extend({}, Exposure.getConfig(), config);
}
/**
@ -207,4 +206,4 @@ export default class Exposure {
return findOne(filters, options);
}
}
};
};