Skip to content

Commit

Permalink
fix(route/inspirehep): fix getAuthorById custom accept header (#17574)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyRL authored Nov 13, 2024
1 parent c37d64c commit 8550150
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 8550150

Please sign in to comment.