From ba6fcf33b0b97a99cf593da530b744961f8f77e4 Mon Sep 17 00:00:00 2001 From: Michael Hewson Date: Mon, 19 Feb 2018 23:56:55 -0500 Subject: [PATCH] docs(headers): document the fact that ::from_str takes a base-64 encoded string I couldn't figure out why my "username:password" strings kept failing to parse into a Basic auth header, until I realized that the implementation expects it to be base-64 encoded, which would be the case if it was coming from HTTP. I'm not sure if this is the best place to document it, but hopefully it will make it more clear for other people / me when I forget. Perhaps a better approach would be to document somewhere that all `FromStr` impls for headers are there for parsing request headers, and not really for creating them. --- src/header/common/authorization.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/header/common/authorization.rs b/src/header/common/authorization.rs index ceda7ca506..97b310d7bb 100644 --- a/src/header/common/authorization.rs +++ b/src/header/common/authorization.rs @@ -167,6 +167,7 @@ impl Scheme for Basic { } } +/// creates a Basic from a base-64 encoded, `:`-delimited utf-8 string impl FromStr for Basic { type Err = ::Error; fn from_str(s: &str) -> ::Result {