0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-27 22:59:51 -05:00

Merge pull request #155 from verdaccio/notify-issue-144

#144 Add fallback support to previous config files
This commit is contained in:
jotadeveloper 2017-04-13 21:39:20 +02:00 committed by GitHub
commit ee99d1fb26

View file

@ -13,7 +13,18 @@ module.exports.notify = function(metadata, config) {
body: content
}
if ( config.notify.headers ) {
// provides fallback support, it's accept an Object {} and Array of {}
if ( config.notify.headers && Array.isArray(config.notify.headers) ) {
var header = {};
config.notify.headers.map(function(item) {
if (Object.is(item, item)) {
for (var key in item) {
header[key] = item[key];
}
}
});
options.headers = header;
} else if (Object.is(config.notify.headers, config.notify.headers)) {
options.headers = config.notify.headers;
}