insomnia/packages/insomnia-app/app/network/bearer-auth/get-header.ts

12 lines
304 B
TypeScript
Raw Normal View History

2018-06-25 17:42:50 +00:00
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;
}