Skip to content

Commit 389868e

Browse files
committed
shorthand for api key in the query string
1 parent f722f83 commit 389868e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/v1/api.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,8 @@ impl OpenAIClient {
168168

169169
let mut request = client.request(method, url);
170170

171-
if self.api_key.is_some() {
172-
request = request.header(
173-
"Authorization",
174-
format!("Bearer {}", self.api_key.as_ref().unwrap()),
175-
);
171+
if let Some(api_key) = &self.api_key {
172+
request = request.header("Authorization", format!("Bearer {}", api_key));
176173
}
177174

178175
if let Some(organization) = &self.organization {

0 commit comments

Comments
 (0)