Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maoertel/diqwest
Crate to extend `reqwest` to be able to send with digest auth flow.
https://github.com/maoertel/diqwest
digest-authentication reqwest reqwest-middleware rust
Last synced: 5 days ago
JSON representation
Crate to extend `reqwest` to be able to send with digest auth flow.
- Host: GitHub
- URL: https://github.com/maoertel/diqwest
- Owner: maoertel
- License: mit
- Created: 2021-10-13T15:35:51.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-20T17:33:46.000Z (5 months ago)
- Last Synced: 2024-10-08T13:09:13.035Z (about 1 month ago)
- Topics: digest-authentication, reqwest, reqwest-middleware, rust
- Language: Rust
- Homepage: https://docs.rs/diqwest
- Size: 54.7 KB
- Stars: 18
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-MIT
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# diqwest
This crate extends `reqwest` to be able to send requests with digest auth flow.
When you send a request with digest auth flow this first request will be executed. In case the response is a `401` the `www-authenticate` header is parsed and the answer is calculated. The initial request is executed again with additional `Authorization` header. The response will be returned from `send_with_digest_auth()`.
In case the first response is not a `401` this first response is returned from `send_with_digest_auth()` without any manipulation. In case the first response is a `401` but the `www-authenticate` header is missing the first reponse is returned as well.
`diqwest` is a lean crate and has nearly no dependencies:
- `reqwest`, for sure, as `diqwest` is an extension to it. Without any enabled features and no default features.
- `digest_auth` is used to calculate the answer. Without any enabled feature and no default features.
- `url` is used to validate urls on type level. Without any enabled feature and no default features.That's it. No other dependencies are used. Not even `thiserror` is used to not force it on you.
## Examples
### Async (default)
```rust
use diqwest::WithDigestAuth;
use reqwest::{Client, Response};// Call `.send_with_digest_auth()` on `RequestBuilder` like `send()`
let response: Response = Client::new()
.get("url")
.send_with_digest_auth("username", "password")
.await?;
```### Blocking (feature flag `blocking` has to be enabled in `Cargo.toml`)
```rust
use diqwest::blocking::WithDigestAuth;
use reqwest::blocking::{Client, Response};// Call `.send_with_digest_auth()` on `RequestBuilder` like `send()`
let response: Response = Client::new()
.get("url")
.send_with_digest_auth("username", "password")?;
```