api/src/lib/github.ts

9 lines · 353 bytes

1// Shared GitHub REST request headers, adds auth when a token is present
2export const githubHeaders = (token?: string): Record<string, string> => {
3  const headers: Record<string, string> = {
4    'User-Agent': 'awesome-privacy-api',
5    Accept: 'application/vnd.github+json',
6  }
7  if (token) headers.Authorization = `token ${token}`
8  return headers
9}