diff options
author | Alex <alex@adnab.me> | 2024-02-07 14:59:40 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2024-02-07 14:59:40 +0000 |
commit | 5d941e0100489fff552b59f0679a2a010403a21c (patch) | |
tree | 5c5cef9af72d48dd7347922341e43f0013380c60 /src/api/s3/delete.rs | |
parent | feeb076b7f5db7fe6fdbe3d2903fae054cde6219 (diff) | |
parent | e011941964b1c1e0b90f85014d166d64a83ae8e2 (diff) | |
download | garage-5d941e0100489fff552b59f0679a2a010403a21c.tar.gz garage-5d941e0100489fff552b59f0679a2a010403a21c.zip |
Merge pull request 'Dependency upgrades: http, hyper, aws-sdk, smaller deps' (#703) from dep-upgrade-202402 into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/703
Diffstat (limited to 'src/api/s3/delete.rs')
-rw-r--r-- | src/api/s3/delete.rs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/api/s3/delete.rs b/src/api/s3/delete.rs index 1c491eac..3fb39147 100644 --- a/src/api/s3/delete.rs +++ b/src/api/s3/delete.rs @@ -1,12 +1,15 @@ use std::sync::Arc; -use hyper::{Body, Request, Response, StatusCode}; +use http_body_util::BodyExt; +use hyper::{Request, Response, StatusCode}; use garage_util::data::*; use garage_model::garage::Garage; use garage_model::s3::object_table::*; +use crate::helpers::*; +use crate::s3::api_server::{ReqBody, ResBody}; use crate::s3::error::*; use crate::s3::put::next_timestamp; use crate::s3::xml as s3_xml; @@ -59,11 +62,11 @@ pub async fn handle_delete( garage: Arc<Garage>, bucket_id: Uuid, key: &str, -) -> Result<Response<Body>, Error> { +) -> Result<Response<ResBody>, Error> { match handle_delete_internal(&garage, bucket_id, key).await { Ok(_) | Err(Error::NoSuchKey) => Ok(Response::builder() .status(StatusCode::NO_CONTENT) - .body(Body::from(vec![])) + .body(empty_body()) .unwrap()), Err(e) => Err(e), } @@ -72,10 +75,10 @@ pub async fn handle_delete( pub async fn handle_delete_objects( garage: Arc<Garage>, bucket_id: Uuid, - req: Request<Body>, + req: Request<ReqBody>, content_sha256: Option<Hash>, -) -> Result<Response<Body>, Error> { - let body = hyper::body::to_bytes(req.into_body()).await?; +) -> Result<Response<ResBody>, Error> { + let body = BodyExt::collect(req.into_body()).await?.to_bytes(); if let Some(content_sha256) = content_sha256 { verify_signed_content(content_sha256, &body[..])?; @@ -118,7 +121,7 @@ pub async fn handle_delete_objects( Ok(Response::builder() .header("Content-Type", "application/xml") - .body(Body::from(xml))?) + .body(string_body(xml))?) } struct DeleteRequest { |