-
Hi, With the new version, it seems we cannot access to the request headers. My use case: http.get(`${urlPrefix}/api/v2/path`, async (request, response, ctx) => {
if (request.headers.get("x-api-key") !== "secret-api-key") {
return response(ctx.status(401), ctx.json(unauthorized401));
}
// .. return 200 with data
} Does anyone know a workaround? |
Beta Was this translation helpful? Give feedback.
Answered by
ghostd
Oct 23, 2023
Replies: 1 comment
-
My bad, it is a TypeScript issue. In plain JS all is fine with this: http.get(`${urlPrefix}/api/v2/path`, async ({request}) => {
if (request.headers.get("x-api-key") !== "secret-api-key") {
return new HttpResponse(unauthorized401, { status: 401 });
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ghostd
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My bad, it is a TypeScript issue. In plain JS all is fine with this: