Skip to content

Commit

Permalink
Merge pull request #351 from whisperfish/auth-header
Browse files Browse the repository at this point in the history
Use Auth header for ws login
  • Loading branch information
rubdos authored Jan 16, 2025
2 parents dd43d93 + 67de052 commit 19c0c78
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/push_service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,20 +219,16 @@ impl PushService {
let mut url = Endpoint::service(path).into_url(&self.cfg)?;
url.set_scheme("wss").expect("valid https base url");

if let Some(credentials) = credentials {
url.query_pairs_mut()
.append_pair("login", &credentials.login())
.append_pair(
"password",
credentials.password.as_ref().expect("a password"),
);
}

let mut builder = self.client.get(url);
for (key, value) in additional_headers {
builder = builder.header(*key, *value);
}

if let Some(credentials) = credentials {
builder =
builder.basic_auth(credentials.login(), credentials.password);
}

let ws = builder
.upgrade()
.send()
Expand Down

0 comments on commit 19c0c78

Please sign in to comment.