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

12 lines
269 B
JavaScript
Raw Normal View History

// @flow
2018-06-25 17:42:50 +00:00
import type { RequestHeader } from '../../models/request';
2018-06-25 17:42:50 +00:00
export function getBearerAuthHeader(
token: string,
prefix: string
): RequestHeader {
const name = 'Authorization';
const value = `${prefix || 'Bearer'} ${token}`;
2018-06-25 17:42:50 +00:00
return { name, value };
}