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