diff --git a/lib/plugins/authentication/before-request.js b/lib/plugins/authentication/before-request.js index b6152d67..6bf2fdbc 100644 --- a/lib/plugins/authentication/before-request.js +++ b/lib/plugins/authentication/before-request.js @@ -1,6 +1,7 @@ module.exports = authenticationBeforeRequest const btoa = require('btoa-lite') +const uniq = require('lodash/uniq') function authenticationBeforeRequest (state, options) { if (!state.auth.type) { @@ -26,7 +27,9 @@ function authenticationBeforeRequest (state, options) { if (state.auth.type === 'app') { options.headers['authorization'] = `Bearer ${state.auth.token}` - options.headers['accept'] = 'application/vnd.github.machine-man-preview+json' + const acceptHeaders = options.headers['accept'].split(',') + .concat('application/vnd.github.machine-man-preview+json') + options.headers['accept'] = uniq(acceptHeaders).filter(Boolean).join(',') return }