Fixes from_one_comma_delimited, no more split at space

Before from_one_comma_delimited split at ",", and " "
this made it unusable for the Accept-* headers since
their fields may contain whitespace.
This commit is contained in:
Pyfisch
2014-12-29 21:03:24 +01:00
parent 27b262c226
commit eac6fe7c93

View File

@@ -31,7 +31,8 @@ pub fn from_one_comma_delimited<T: FromStr>(raw: &[u8]) -> Option<Vec<T>> {
match from_utf8(raw) {
Ok(s) => {
Some(s.as_slice()
.split([',', ' '].as_slice())
.split(',')
.map(|x| x.trim())
.filter_map(FromStr::from_str)
.collect())
}