handleGET: hide S3 bucket responses
This commit is contained in:
parent
1af297c537
commit
3b1602d2bc
1 changed files with 11 additions and 1 deletions
|
@ -37,7 +37,17 @@ handleGET = (request) ->
|
|||
return new Response "Invalid URL",
|
||||
status: 404
|
||||
|
||||
return await s3.getObject url.pathname[1...], {}
|
||||
resp = await s3.getObject url.pathname[1...], {}
|
||||
|
||||
if not resp.ok
|
||||
headers = new Headers resp.headers
|
||||
headers.set "Content-Length", 0
|
||||
return new Response null,
|
||||
status: resp.status
|
||||
statusText: resp.statusText
|
||||
headers: headers
|
||||
else
|
||||
return resp
|
||||
|
||||
handlePUT = (request) ->
|
||||
url = new URL request.url
|
||||
|
|
Loading…
Reference in a new issue