mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
14 lines
394 B
JavaScript
14 lines
394 B
JavaScript
|
const getCreds = (user, pass, encoding) => ({
|
||
|
raw: { user, pass },
|
||
|
encoded: {
|
||
|
user: Buffer.from(user, encoding).toString(),
|
||
|
pass: Buffer.from(pass, encoding).toString(),
|
||
|
},
|
||
|
combined: Buffer.from(`${user}:${pass}`, encoding).toString('base64'),
|
||
|
});
|
||
|
|
||
|
export const basicAuthCreds = {
|
||
|
utf8: getCreds('user', 'pass', 'utf8'),
|
||
|
latin1: getCreds('user-é', 'pass-é', 'latin1'),
|
||
|
};
|