Fixed typo in Worker

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
ItalyPaleAle 2022-12-29 01:09:58 +00:00
parent f0090c137c
commit bea0774b4c
3 changed files with 5 additions and 4 deletions

View File

@ -44,6 +44,7 @@ const router = Router()
continue
}
switch (obj.constructor.name) {
case 'KvNamespace':
case 'KVNamespace':
kv.push(all[i])
break
@ -170,7 +171,7 @@ async function setupKVRequest(
return { errorRes: new Response('Bad request', { status: 400 }) }
}
const namespace = env[req.params.namespace] as KVNamespace<string>
if (typeof namespace != 'object' || namespace?.constructor?.name != 'KVNamespace') {
if (typeof namespace != 'object' || !['KVNamespace', 'KvNamespace'].includes(namespace?.constructor?.name)) {
return {
errorRes: new Response(
`Worker is not bound to KV '${req.params.kv}'`,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long