fix(route/inspirehep): fix getAuthorById custom accept header (#17574)

This commit is contained in:
Tony
2024-11-13 09:27:46 -08:00
committed by GitHub
parent c37d64c26b
commit 8550150086
+9 -1
View File
@@ -19,7 +19,15 @@ export const route: Route = {
handler,
};
export const getAuthorById = (id: string) => cache.tryGet(`inspirehep:author:${id}`, () => ofetch<AuthorResponse>(`${baseUrl}/api/authors/${id}`));
export const getAuthorById = (id: string) =>
cache.tryGet(`inspirehep:author:${id}`, () =>
ofetch<AuthorResponse>(`${baseUrl}/api/authors/${id}`, {
headers: {
accept: 'application/vnd+inspire.record.ui+json',
},
parseResponse: JSON.parse,
})
);
async function handler(ctx) {
const id = ctx.req.param('id');