File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,10 @@ self.addEventListener("install", function (event) {
1515 ) ;
1616} ) ;
1717
18+ function jsonify ( data ) {
19+ return Response ( JSON . stringify ( data ) , { headers : { 'content-type' : 'application/json' } } )
20+ }
21+
1822async function upload ( request , url ) {
1923 const formData = await request . formData ( )
2024 const file = formData . getAll ( 'file' ) [ 0 ]
@@ -33,13 +37,13 @@ async function upload(request, url) {
3337 'server' : 'ServiceWorker' ,
3438 }
3539 } ) )
36- return Response . json ( { code : 0 , data : fileUrl } )
40+ return jsonify ( { code : 0 , data : fileUrl } )
3741}
3842
3943async function remove ( request , url ) {
4044 const cache = await caches . open ( CHATGPT_NEXT_WEB_FILE_CACHE )
4145 const res = await cache . delete ( request . url )
42- return Response . json ( { code : 0 } )
46+ return jsonify ( { code : 0 } )
4347}
4448
4549self . addEventListener ( "fetch" , ( e ) => {
You can’t perform that action at this time.
0 commit comments