Skip to content

Commit

Permalink
Merge pull request #194 from Enraged-Dun-Cookie-Development-Team/fix-…
Browse files Browse the repository at this point in the history
…修复路由拼接

🐛 修复腾讯云路由拼接
  • Loading branch information
phidiaLam authored Jun 10, 2024
2 parents e3ee6bd + 269e05c commit 28017ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion logic/bakery_logic/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl BakeryTcCdnPath {
}

PurgeCachePath::new_with_query(
"/canteen/bakery/mansionInfo",
"/cdn/bakery/mansionInfo",
&MansionId { mansion_id: mid },
)
}
Expand Down
14 changes: 13 additions & 1 deletion middle-server/tencent-cloud-server/src/cdn/purge_urls_cache.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use general_request_client::Url;
use serde::Serialize;
use url::Position;

use super::{SERVICE, VERSION};
use crate::{
Expand Down Expand Up @@ -45,7 +46,8 @@ impl TcCloudManager {
.into_iter()
.map(|PurgeCachePath { path, query }| {
let mut url = Url::clone(&*self.cdn_base_url);
url.set_path(path);
let prefix = &url[Position::BeforePath..];
url.set_path(&(prefix.to_string() + path));
url.set_query(query.as_deref());
url
})
Expand All @@ -72,6 +74,7 @@ mod test {
use mime::Mime;
use serde::Serialize;
use typed_builder::TypedBuilder;
use url::{Position, Url};

#[derive(Debug, Clone, TypedBuilder)]
pub struct RequestContent<P: Serialize, Q: Serialize + Clone> {
Expand All @@ -94,4 +97,13 @@ mod test {

println!("{}", canonical_query);
}

#[test]
fn test_url() {
let mut url = Url::parse("http://server-cdn-dev.ceobecanteen.top/api/v1").unwrap();

let prefix = &url[Position::BeforePath..];
url.set_path(&(prefix.to_string() + "/test/test"));
println!("{}", url)
}
}

0 comments on commit 28017ee

Please sign in to comment.