We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 64dafc0 commit 66c2ab8Copy full SHA for 66c2ab8
1 file changed
src/index.js
@@ -29,16 +29,22 @@ async function retry(action) {
29
}
30
31
32
-function fetchSafely(url, token) {
+function fetchSafely(url, token, options = {}) {
33
return retry(async () => {
34
log('fetch "%s"', url)
35
- /* c8 ignore next 6 */
+ /* c8 ignore next 7 */
36
if (!token) token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN
37
- const options = token ? {
38
- headers: {
39
- Authorization: `Bearer ${token}`
+ if (token) {
+ options.headers = {
+ Authorization: `Bearer ${token}`,
40
+ ...options.headers
41
- } : undefined
42
+ }
43
+ options = {
44
+ 'User-Agent': 'prantlf/grab-github-release',
45
+ 'X-GitHub-Api-Version': '2022-11-28',
46
+ ...options
47
48
const res = await fetch(url, options)
49
/* c8 ignore next 5 */
50
if (!res.ok) {
0 commit comments