MCPcopy Create free account
hub / github.com/pollinations/pollinations / extractApiKey

Function extractApiKey

shared/auth/api-key.ts:182–188  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

180}
181
182export function extractApiKey(request: Request): string | null {
183 const auth = request.headers.get("authorization");
184 const match = auth?.match(/^Bearer (.+)$/);
185 if (match?.[1]) return match[1];
186
187 return new URL(request.url).searchParams.get("key");
188}
189
190export function assertNotBanned(user: {
191 banned?: boolean | null;

Callers 1

Calls 1

getMethod · 0.65

Tested by

no test coverage detected