src/http/middleware/set-auth-headers.js
function addAuthHeaders ({ 
  auth,
  bearerToken, 
  headers, 
  overrideHeaders=false, 
}) {
  if (overrideHeaders) return
  if (bearerToken) return { 
    headers: { ...headers, Authorization: `Bearer ${ bearerToken }` } 
  }
  if (auth) {
    const username = auth.username || ''
    const password = auth.password || ''
    const encodedToken = Base64.btoa(`${ username }:${ password }`)
    return {
      headers: { ...headers, Authorization: `Basic ${ encodedToken }` }
    }
  }
}
function addAuthHeaders ({ 
  auth,
  bearerToken, 
  headers, 
  overrideHeaders=false, 
}) {
  if (overrideHeaders) return
  if (bearerToken) return { 
    headers: { ...headers, Authorization: `Bearer ${ bearerToken }` } 
  }
  if (auth) {
    const username = auth.username || ''
    const password = auth.password || ''
    const encodedToken = Base64.btoa(`${ username }:${ password }`)
    return {
      headers: { ...headers, Authorization: `Basic ${ encodedToken }` }
    }
  }
}
function addAuthHeaders ( { auth , bearerToken , headers , overrideHeaders = false , } ) { if ( overrideHeaders ) return if ( bearerToken ) return { headers : { ... headers , Authorization : ` ${ bearerToken } ` } } if ( auth ) { const username = auth . username || '' const password = auth . password || '' const encodedToken = Base64 . btoa ( ` ${ username } ${ password } ` ) return { headers : { ... headers , Authorization : ` ${ encodedToken } ` } } } }
Sets auth headers if necessary
Sets auth headers if necessary