Keep `ureq::Agent` for native clients
- Dominant language
- Rust
- Stars
- 396
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
I love the simple API of this crate! It can be useful if `ehttp` supports saving cookies, such as login function. Currently, the "agent" ([ureq::Agent](https://docs.rs/ureq/latest/ureq/struct.Agent.html) type) is not continuous between each request.
A cross-platform and object-oriented example might look like this:
```rust
pub struct Agent {
#[cfg(not(target_arch = "wasm32"))]
agent: ureq::Agent,
}
// save the session if we need (compatible syntax)
let session = Agent::new();
session.fetch(req, |r| match r {
Ok(r) if r.ok => alert("Login successfully!"),
_ => alert("Login failed!"),
});
// original "fetch" function
fetch(req, |r| match r {
Ok(r) if r.ok => alert("Login successfully!"),
_ => alert("Login failed!"),
});
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.