Skip to content

Commit 1aa608e

Browse files
committed
fix(play): add auth
1 parent b163d63 commit 1aa608e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

playground/functions/api/state/[key].ts

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ export const onRequestGet = makePagesFunction(async ({ params, env }) => {
1111
});
1212

1313
export const onRequestPost = makePagesFunction(async ({ params, request, env }) => {
14+
if (request.headers.get('Authorization') !== 'vite-plugin-cloudflare-functions') {
15+
return new Response('Unauthorized', { status: 401 });
16+
}
17+
1418
const key = params.key as string;
1519
const value = await request.text();
1620
await env.STORE.put(key, value, { expirationTtl: 300 });

0 commit comments

Comments
 (0)