insomnia/packages/insomnia-app/app/network/bearer-auth/get-header.ts
Dimitri Mitropoulos 5f4c19da35
[TypeScript] Phase 1 & 2 (#3370)
Co-authored-by: Opender Singh <opender.singh@konghq.com>
2021-05-12 18:35:00 +12:00

12 lines
304 B
TypeScript

import type { RequestHeader } from '../../models/request';
export function getBearerAuthHeader(token: string, prefix: string) {
const name = 'Authorization';
const value = `${prefix || 'Bearer'} ${token}`;
const requestHeader: RequestHeader = {
name,
value,
};
return requestHeader;
}