diff --git a/awc/CHANGES.md b/awc/CHANGES.md index b5f64dd3..fd5d0190 100644 --- a/awc/CHANGES.md +++ b/awc/CHANGES.md @@ -1,5 +1,12 @@ # Changes +## [0.2.2] - TBD + +### Changed + +* Always append a colon after username in basic auth + + ## [0.2.1] - 2019-06-05 ### Added diff --git a/awc/src/builder.rs b/awc/src/builder.rs index 2bc52a43..a58265c5 100644 --- a/awc/src/builder.rs +++ b/awc/src/builder.rs @@ -115,7 +115,7 @@ impl ClientBuilder { { let auth = match password { Some(password) => format!("{}:{}", username, password), - None => format!("{}", username), + None => format!("{}:", username), }; self.header( header::AUTHORIZATION, @@ -164,7 +164,7 @@ mod tests { .unwrap() .to_str() .unwrap(), - "Basic dXNlcm5hbWU=" + "Basic dXNlcm5hbWU6" ); } diff --git a/awc/src/request.rs b/awc/src/request.rs index 5c09df81..36cd6fcf 100644 --- a/awc/src/request.rs +++ b/awc/src/request.rs @@ -280,7 +280,7 @@ impl ClientRequest { { let auth = match password { Some(password) => format!("{}:{}", username, password), - None => format!("{}", username), + None => format!("{}:", username), }; self.header( header::AUTHORIZATION, @@ -664,7 +664,7 @@ mod tests { .unwrap() .to_str() .unwrap(), - "Basic dXNlcm5hbWU=" + "Basic dXNlcm5hbWU6" ); } diff --git a/awc/src/ws.rs b/awc/src/ws.rs index d3e06d3d..95bf6ef7 100644 --- a/awc/src/ws.rs +++ b/awc/src/ws.rs @@ -195,7 +195,7 @@ impl WebsocketsRequest { { let auth = match password { Some(password) => format!("{}:{}", username, password), - None => format!("{}", username), + None => format!("{}:", username), }; self.header(AUTHORIZATION, format!("Basic {}", base64::encode(&auth))) } @@ -443,7 +443,7 @@ mod tests { .unwrap() .to_str() .unwrap(), - "Basic dXNlcm5hbWU=" + "Basic dXNlcm5hbWU6" ); }