From 6e53d7263cd96a80c63d347a032c0104ea1d98bf Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 26 Mar 2024 03:02:47 +0800 Subject: [PATCH] fix(core): accept header not working (#14961) --- lib/routes/github/starred-repos.ts | 5 +++-- lib/utils/request-wrapper.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/routes/github/starred-repos.ts b/lib/routes/github/starred-repos.ts index ce56d6abe..707d84e12 100644 --- a/lib/routes/github/starred-repos.ts +++ b/lib/routes/github/starred-repos.ts @@ -40,15 +40,16 @@ async function handler(ctx) { }, }); - const data = response.map((repo) => ({ + const data = response.map(({ starred_at, repo }) => ({ title: `${user} starred ${repo.name}`, author: user, description: `${repo.description ?? 'No Description'}
Primary Language: ${repo.language ?? 'Primary Language'}
Stargazers: ${repo.stargazers_count}
`, - pubDate: parseDate(repo.starred_at), + pubDate: parseDate(starred_at), link: repo.html_url, + category: repo.topics, })); return { diff --git a/lib/utils/request-wrapper.ts b/lib/utils/request-wrapper.ts index 98e0a3a2d..352f7d2db 100644 --- a/lib/utils/request-wrapper.ts +++ b/lib/utils/request-wrapper.ts @@ -60,7 +60,7 @@ const requestWrapper = (url: string, options: http.RequestOptions = {}) => { } // Accept - if (!headersLowerCaseKeys.has('Accept')) { + if (!headersLowerCaseKeys.has('accept')) { options.headers.Accept = '*/*'; }