From 855015008672b0639be441387f1796b697004a48 Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 13 Nov 2024 09:27:46 -0800 Subject: [PATCH] fix(route/inspirehep): fix getAuthorById custom accept header (#17574) --- lib/routes/inspirehep/author.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/routes/inspirehep/author.ts b/lib/routes/inspirehep/author.ts index ed7eb2b6d49076..768ebea1d06749 100644 --- a/lib/routes/inspirehep/author.ts +++ b/lib/routes/inspirehep/author.ts @@ -19,7 +19,15 @@ export const route: Route = { handler, }; -export const getAuthorById = (id: string) => cache.tryGet(`inspirehep:author:${id}`, () => ofetch(`${baseUrl}/api/authors/${id}`)); +export const getAuthorById = (id: string) => + cache.tryGet(`inspirehep:author:${id}`, () => + ofetch(`${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');