File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -8,16 +8,27 @@ export default async (request: Request, context: Context) => {
88 const url = new URL ( request . url ) ;
99 const key = url . searchParams . get ( 'key' ) ;
1010
11- if ( ! key ) {
12- return new Response ( 'No key provided' , { status : 400 } ) ;
13- }
14-
1511 switch ( request . method ) {
1612 case 'POST' :
13+ if ( ! key ) {
14+ return new Response ( 'No key provided' , { status : 400 } ) ;
15+ }
16+
1717 const body = await request . json ( ) ;
1818 await store . setJSON ( key , body ) ;
1919 return new Response ( 'Blob successfully stored' , { status : 200 } ) ;
2020 case 'GET' :
21+ if ( ! key ) {
22+ const list = await store . list ( ) ;
23+
24+ return new Response ( JSON . stringify ( list ) , {
25+ status : 200 ,
26+ headers : {
27+ 'Content-Type' : 'application/json' ,
28+ } ,
29+ } ) ;
30+ }
31+
2132 const value = await store . get ( key ) ;
2233 return new Response ( value , {
2334 status : 200 ,
You can’t perform that action at this time.
0 commit comments