if no username, then no auth. otherwise no auth mechanism defined

This commit is contained in:
igor 2016-08-14 09:22:34 +03:00
parent bdc943a57c
commit 6fa0ca2ace

View File

@ -5,8 +5,9 @@ import request from 'request';
const OWNER = 'zeit';
const REPO = 'pkg-cache';
const { GITHUB_USERNAME, GITHUB_PASSWORD } = process.env;
const auth = { user: GITHUB_USERNAME, pass: GITHUB_PASSWORD };
const request2 = request.defaults({
auth: { user: GITHUB_USERNAME, pass: GITHUB_PASSWORD },
auth: auth.user ? auth : null,
headers: { 'User-Agent': `${OWNER}/${REPO}/${GITHUB_USERNAME}` }
});