aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3_cors.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-01-24 12:03:57 +0100
committerAlex Auvolat <alex@adnab.me>2022-01-24 12:32:28 +0100
commit513a6b15f99983c2054b95c6a17cebf672dbd360 (patch)
tree6b6e8efdc96a2aeaeb2f9f91109c58e883a0ec39 /src/api/s3_cors.rs
parentea7fb901ebc316bba53d248a2f8bd7a3455f5791 (diff)
downloadgarage-513a6b15f99983c2054b95c6a17cebf672dbd360.tar.gz
garage-513a6b15f99983c2054b95c6a17cebf672dbd360.zip
Handle OPTIONS on website endpointbucket-cors
Diffstat (limited to 'src/api/s3_cors.rs')
-rw-r--r--src/api/s3_cors.rs22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/api/s3_cors.rs b/src/api/s3_cors.rs
index d23bf48d..cde66079 100644
--- a/src/api/s3_cors.rs
+++ b/src/api/s3_cors.rs
@@ -18,16 +18,7 @@ use garage_model::garage::Garage;
use garage_table::*;
use garage_util::data::*;
-pub async fn handle_get_cors(
- garage: Arc<Garage>,
- bucket_id: Uuid,
-) -> Result<Response<Body>, Error> {
- let bucket = garage
- .bucket_table
- .get(&EmptyKey, &bucket_id)
- .await?
- .ok_or(Error::NoSuchBucket)?;
-
+pub async fn handle_get_cors(bucket: &Bucket) -> Result<Response<Body>, Error> {
let param = bucket
.params()
.ok_or_internal_error("Bucket should not be deleted at this point")?;
@@ -109,16 +100,7 @@ pub async fn handle_put_cors(
.body(Body::empty())?)
}
-pub async fn handle_options(
- garage: Arc<Garage>,
- req: &Request<Body>,
- bucket_id: Uuid,
-) -> Result<Response<Body>, Error> {
- let bucket = garage
- .bucket_table
- .get(&EmptyKey, &bucket_id)
- .await?
- .ok_or(Error::NoSuchBucket)?;
+pub async fn handle_options(req: &Request<Body>, bucket: &Bucket) -> Result<Response<Body>, Error> {
let origin = req
.headers()
.get("Origin")