mirror of https://github.com/fafhrd91/actix-web
fmt
This commit is contained in:
parent
3b642c8545
commit
26b9b3d29f
|
@ -20,6 +20,7 @@
|
|||
[#2024]: https://github.com/actix/actix-web/pull/2024
|
||||
[#2050]: https://github.com/actix/actix-web/pull/2050
|
||||
|
||||
|
||||
## 3.0.0-beta.2 - 2021-02-10
|
||||
### Added
|
||||
* `ClientRequest::insert_header` method which allows using typed headers. [#1869]
|
||||
|
|
|
@ -255,11 +255,7 @@ impl ClientRequest {
|
|||
/// Set HTTP basic authorization header.
|
||||
///
|
||||
/// If no password is needed, just provide an empty string.
|
||||
pub fn basic_auth(
|
||||
self,
|
||||
username: impl fmt::Display,
|
||||
password: impl fmt::Display,
|
||||
) -> Self {
|
||||
pub fn basic_auth(self, username: impl fmt::Display, password: impl fmt::Display) -> Self {
|
||||
let auth = format!("{}:{}", username, password);
|
||||
|
||||
self.insert_header((
|
||||
|
@ -642,9 +638,7 @@ mod tests {
|
|||
|
||||
#[actix_rt::test]
|
||||
async fn client_basic_auth() {
|
||||
let req = Client::new()
|
||||
.get("/")
|
||||
.basic_auth("username", "password");
|
||||
let req = Client::new().get("/").basic_auth("username", "password");
|
||||
assert_eq!(
|
||||
req.head
|
||||
.headers
|
||||
|
|
Loading…
Reference in New Issue