From ba21fbd7bf92fd5bd6e3f9f47fde389e3812a2f9 Mon Sep 17 00:00:00 2001 From: Luc Georges <luc.sydney.georges@gmail.com> Date: Mon, 9 Dec 2024 14:00:04 +0100 Subject: [PATCH] feat: add `endpoint` method the `ApiBuilder` In tandem with the recent addition of the `HF_ENDPOINT`, we add a method to set the HTTP endpoint for the Hub. --- src/api/tokio.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api/tokio.rs b/src/api/tokio.rs index b616fa0..5974b5e 100644 --- a/src/api/tokio.rs +++ b/src/api/tokio.rs @@ -143,6 +143,12 @@ impl ApiBuilder { self } + /// Sets the Hub's HTTP URL + pub fn endpoint(mut self, endpoint: String) -> Self { + self.endpoint = endpoint; + self + } + fn build_headers(&self) -> Result<HeaderMap, ApiError> { let mut headers = HeaderMap::new(); let user_agent = format!("unkown/None; {NAME}/{VERSION}; rust/unknown");