Skip to content

Commit

Permalink
fix case of passing username when no auth specified
Browse files Browse the repository at this point in the history
  • Loading branch information
tapans committed Dec 17, 2024
1 parent 3d0ca94 commit 0c9f91f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/api/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ impl ApiClient {
// this will allow the user to not have to specify the auth type for each request and
// xurl will be able to choose the correct auth type based on the route
let token = {
let auth_ref = auth.borrow();
auth_ref.first_oauth2_token()
let mut auth_ref = auth.borrow_mut();
if let Some(username) = username {
auth_ref.get_token_store().get_oauth2_token(username)
} else {
auth_ref.first_oauth2_token()
}
};
if let Some(token) = token {
match token {
Expand Down Expand Up @@ -179,6 +183,7 @@ impl ApiClient {
.build_request(method, endpoint, headers, data, auth_type, username)
.await?;


let response = request_builder.send().await?;

let status = response.status();
Expand Down

0 comments on commit 0c9f91f

Please sign in to comment.