Created
June 17, 2017 08:00
-
-
Save andete/7572bfddf3503f7f9b8f09c0157d90e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Referer { | |
url:String | |
} | |
impl<'a, 'r> FromRequest<'a, 'r> for Referer { | |
type Error = (); | |
fn from_request(request: &'a Request<'r>) -> Outcome<Referer, ()> { | |
match request.headers().get_one("Referer") { | |
Some(r) => Success(Referer { url:r.into() }), | |
None => Forward(()), | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment