Fix review comments
This commit is contained in:
@@ -26,9 +26,9 @@ impl Header for Accept {
|
||||
"Accept"
|
||||
}
|
||||
|
||||
fn parse_header(_raw: &[Vec<u8>]) -> Option<Accept> {
|
||||
fn parse_header(raw: &[Vec<u8>]) -> Option<Accept> {
|
||||
let mut mimes: Vec<Mime> = vec![];
|
||||
for mimes_raw in _raw.iter() {
|
||||
for mimes_raw in raw.iter() {
|
||||
match from_utf8(mimes_raw.as_slice()) {
|
||||
Some(mimes_str) => {
|
||||
for mime_str in mimes_str.split(',') {
|
||||
|
||||
@@ -388,10 +388,10 @@ mod tests {
|
||||
let text_plain = Mime(Text, Plain, vec![]);
|
||||
let application_vendor = from_str("application/vnd.github.v3.full+json; q=0.5").unwrap();
|
||||
|
||||
let accept = Header::parse_header(["text/plain".as_bytes().to_vec()].as_slice());
|
||||
let accept = Header::parse_header([b"text/plain".to_vec()].as_slice());
|
||||
assert_eq!(accept, Some(Accept(vec![text_plain.clone()])));
|
||||
|
||||
let accept = Header::parse_header(["application/vnd.github.v3.full+json; q=0.5, text/plain".as_bytes().to_vec()].as_slice());
|
||||
let accept = Header::parse_header([b"application/vnd.github.v3.full+json; q=0.5, text/plain".to_vec()].as_slice());
|
||||
assert_eq!(accept, Some(Accept(vec![application_vendor, text_plain])));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user