Skip to content

Commit 2068765

Browse files
committed
added check for api key version, and only modify url if we have api key set
1 parent 8f5ecd2 commit 2068765

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/v1/api.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ impl OpenAIClient {
141141
}
142142

143143
async fn build_request(&self, method: Method, path: &str) -> reqwest::RequestBuilder {
144-
let url = format!(
145-
"{}/{}?api-version={}",
146-
self.api_endpoint,
147-
path,
148-
self.api_version.as_deref().unwrap_or("v1")
149-
);
144+
let mut url = format!("{}/{}", self.api_endpoint, path);
145+
146+
if self.api_version.is_some() {
147+
let api_version = self.api_version.as_ref().unwrap();
148+
url = format!("{}?api-version={}", url, api_version);
149+
}
150150

151151
let client = Client::builder();
152152

0 commit comments

Comments
 (0)