Skip to content

Commit 9682684

Browse files
committed
Remove double slashes in purge URL for Fastly
Leading slashes are now remove from paths that should be invalidated on Fastly to prevent repeating the slash in the URL.
1 parent 582c48a commit 9682684

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/fastly.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ impl Fastly {
1717
}
1818

1919
pub fn purge(&mut self, path: &str) -> Result<(), Error> {
20-
let url = format!("https://api.fastly.com/purge/{}/{}", self.domain, path);
20+
let sanitized_path = path.trim_start_matches('/');
21+
let url = format!(
22+
"https://api.fastly.com/purge/{}/{}",
23+
self.domain, sanitized_path
24+
);
2125

2226
self.start_new_request()?;
2327

0 commit comments

Comments
 (0)