Skip to content

Commit

Permalink
fix(route/inspirehep): fix getAuthorById custom accept header
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyRL committed Nov 13, 2024
1 parent 716c0a3 commit 95339b9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/routes/inspirehep/author.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 95339b9

Please sign in to comment.