1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 17:07:01 +02:00

rustfmt 0.7

This commit is contained in:
Nikolay Kim
2018-05-17 12:20:20 -07:00
parent 564cc15c04
commit 45e9aaa462
58 changed files with 508 additions and 758 deletions

View File

@@ -53,7 +53,8 @@ impl<'a> ConnectionInfo<'a> {
// scheme
if scheme.is_none() {
if let Some(h) = req.headers()
if let Some(h) = req
.headers()
.get(HeaderName::from_str(X_FORWARDED_PROTO).unwrap())
{
if let Ok(h) = h.to_str() {
@@ -74,7 +75,8 @@ impl<'a> ConnectionInfo<'a> {
// host
if host.is_none() {
if let Some(h) = req.headers()
if let Some(h) = req
.headers()
.get(HeaderName::from_str(X_FORWARDED_HOST).unwrap())
{
if let Ok(h) = h.to_str() {
@@ -98,7 +100,8 @@ impl<'a> ConnectionInfo<'a> {
// remote addr
if remote.is_none() {
if let Some(h) = req.headers()
if let Some(h) = req
.headers()
.get(HeaderName::from_str(X_FORWARDED_FOR).unwrap())
{
if let Ok(h) = h.to_str() {
@@ -189,10 +192,8 @@ mod tests {
assert_eq!(info.remote(), Some("192.0.2.60"));
let mut req = HttpRequest::default();
req.headers_mut().insert(
header::HOST,
HeaderValue::from_static("rust-lang.org"),
);
req.headers_mut()
.insert(header::HOST, HeaderValue::from_static("rust-lang.org"));
let info = ConnectionInfo::new(&req);
assert_eq!(info.scheme(), "http");