mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-10-29 06:44:24 +00:00
major revamp of http client functionalit
This commit is contained in:
1 parent
ff531e6964
commit
446000ee97
35 files changed
+906
-433
No files matched your search
@@ -0,0 +1,10 @@
|
||||
const toBase64 = (str) => Buffer.from(str || '', 'utf8').toString('base64');
|
||||
|
||||
module.exports = (auth) => {
|
||||
if (!auth || !auth.username ||
|
||||
typeof auth.username !== 'string' ||
|
||||
(auth.password && typeof auth.password !== 'string')) return {};
|
||||
const creds = `${auth.username}:${auth.password || ''}`;
|
||||
const header = `Basic ${toBase64(creds)}`;
|
||||
return {Authorization: header};
|
||||
};
|
||||
Reference in new issue
Block a user