From 6defd70a2df0975ee22b09018a9dc709a7933200 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 6 Apr 2022 09:51:31 +0300 Subject: feat! add chunk server API version to HTTP paths What was /chunks is now /v1/chunks. This is the minimal step to start supporting multiple API versions. Also, /v1/chunks/foo/bar is no longer supported. Sponsored-by: author --- src/bin/obnam-server.rs | 8 ++++++++ src/client.rs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/bin/obnam-server.rs b/src/bin/obnam-server.rs index 5be2cee..6cf4122 100644 --- a/src/bin/obnam-server.rs +++ b/src/bin/obnam-server.rs @@ -47,27 +47,35 @@ async fn main() -> anyhow::Result<()> { debug!("Configuration: {:#?}", config); let create = warp::post() + .and(warp::path("v1")) .and(warp::path("chunks")) + .and(warp::path::end()) .and(store.clone()) .and(warp::header("chunk-meta")) .and(warp::filters::body::bytes()) .and_then(create_chunk); let fetch = warp::get() + .and(warp::path("v1")) .and(warp::path("chunks")) .and(warp::path::param()) + .and(warp::path::end()) .and(store.clone()) .and_then(fetch_chunk); let search = warp::get() + .and(warp::path("v1")) .and(warp::path("chunks")) + .and(warp::path::end()) .and(warp::query::>()) .and(store.clone()) .and_then(search_chunks); let delete = warp::delete() + .and(warp::path("v1")) .and(warp::path("chunks")) .and(warp::path::param()) + .and(warp::path::end()) .and(store.clone()) .and_then(delete_chunk); diff --git a/src/client.rs b/src/client.rs index 5b13cb7..c5d66c1 100644 --- a/src/client.rs +++ b/src/client.rs @@ -131,7 +131,7 @@ impl BackupClient { } fn chunks_url(&self) -> String { - format!("{}/chunks", self.base_url()) + format!("{}/v1/chunks", self.base_url()) } /// Does the server have a chunk? -- cgit v1.2.1