Skip to content

Commit

Permalink
Improve checks on authentication so have wiggle room in future
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews authored and jastack committed Jan 24, 2018
1 parent 240a519 commit c9df375
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ module.exports = ({ url, store, cache, createNode, auth = {} }) =>
// See if there's response headers for this url
// from a previous request.
const cachedHeaders = await cache.get(cacheId(url))
const headers = {
auth: auth.htaccess_user + `:` + auth.htaccess_pass,
const headers = {}

// Add htaccess authentication if passed in. This isn't particularly
// extensible. We should define a proper API that we validate.
if (auth && auth.htaccess_pass && auth.htaccess_user) {
headers.auth = `${auth.htaccess_user}:${auth.htaccess_pass}`
}

if (cachedHeaders && cachedHeaders.etag) {
headers[`If-None-Match`] = cachedHeaders.etag
}
Expand Down

0 comments on commit c9df375

Please sign in to comment.