This commit is contained in:
parent
2868c329e1
commit
7b22fb2a2d
1 changed files with 1 additions and 1 deletions
|
|
@ -7,7 +7,7 @@ import HttpStatus from "../interfaces/http-status";
|
||||||
export async function handleInternalAuth(request: express.Request) {
|
export async function handleInternalAuth(request: express.Request) {
|
||||||
// รองรับ header หลายรูปแบบ
|
// รองรับ header หลายรูปแบบ
|
||||||
const apiKey =
|
const apiKey =
|
||||||
request.headers["api-key"] || request.headers["apikey"];
|
request.headers["api-key"] || request.headers["api_key"] || request.headers["apikey"];
|
||||||
|
|
||||||
if (!apiKey || typeof apiKey !== "string") {
|
if (!apiKey || typeof apiKey !== "string") {
|
||||||
throw new HttpError(HttpStatus.UNAUTHORIZED, "API Key is required");
|
throw new HttpError(HttpStatus.UNAUTHORIZED, "API Key is required");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue