Fix review comments

This commit is contained in:
Stanislav Panferov
2014-10-06 22:27:08 +04:00
parent f6ac243c85
commit 2995923505
2 changed files with 4 additions and 4 deletions

View File

@@ -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(',') {

View File

@@ -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])));
}