File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -15,14 +15,14 @@ impl HeaderValue {
15
15
///
16
16
/// # Error
17
17
///
18
- /// This function will error if the string
18
+ /// This function will error if the string is not a valid ASCII.
19
19
pub fn from_ascii ( bytes : & [ u8 ] ) -> Result < Self , ParseError > {
20
20
if !bytes. is_ascii ( ) {
21
21
return Err ( ParseError :: new ( ) ) ;
22
22
}
23
23
24
24
// This is permitted because ASCII is valid UTF-8, and we just checked that.
25
- let string = unsafe { String :: from_utf8_unchecked ( bytes. to_ascii_lowercase ( ) ) } ;
25
+ let string = unsafe { String :: from_utf8_unchecked ( bytes. to_vec ( ) ) } ;
26
26
Ok ( Self { inner : string } )
27
27
}
28
28
@@ -75,13 +75,13 @@ impl FromStr for HeaderValue {
75
75
76
76
/// Create a new `HeaderValue`.
77
77
///
78
- /// This checks it's valid ASCII, and lowercases it .
78
+ /// This checks it's valid ASCII.
79
79
fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
80
80
if !s. is_ascii ( ) {
81
81
return Err ( ParseError :: new ( ) ) ;
82
82
}
83
83
Ok ( Self {
84
- inner : s . to_ascii_lowercase ( ) ,
84
+ inner : String :: from ( s ) ,
85
85
} )
86
86
}
87
87
}
You can’t perform that action at this time.
0 commit comments