@@ -971,41 +971,32 @@ mod tests {
971971 assert_eq ! ( link. ok( ) , Some ( expected_link) ) ;
972972 }
973973
974- // TODO
975- // #[test]
976- // fn test_link_multiple_link_headers() {
977- // let first_link = LinkValue::new("/TheBook/chapter2")
978- // .push_rel(RelationType::Previous)
979- // .set_title_star("UTF-8'de'letztes%20Kapitel");
980-
981- // let second_link = LinkValue::new("/TheBook/chapter4")
982- // .push_rel(RelationType::Next)
983- // .set_title_star("UTF-8'de'n%c3%a4chstes%20Kapitel");
984-
985- // let third_link = LinkValue::new("http://example.com/TheBook/chapter2")
986- // .push_rel(RelationType::Previous)
987- // .push_rev(RelationType::Next)
988- // .set_title("previous chapter");
989-
990- // let expected_link = Link::new(vec![first_link, second_link, third_link]);
991-
992- // let mut raw = BytesMut::from(b"GET /super_short_uri/and_whatever HTTP/1.1\r\nHost: \
993- // hyper.rs\r\nAccept: a lot of things\r\nAccept-Charset: \
994- // utf8\r\nAccept-Encoding: *\r\nLink: </TheBook/chapter2>; \
995- // rel=\"previous\"; title*=UTF-8'de'letztes%20Kapitel, \
996- // </TheBook/chapter4>; rel=\"next\"; title*=\
997- // UTF-8'de'n%c3%a4chstes%20Kapitel\r\n\
998- // Access-Control-Allow-Credentials: None\r\nLink: \
999- // <http://example.com/TheBook/chapter2>; \
1000- // rel=\"previous\"; rev=next; title=\"previous chapter\"\
1001- // \r\n\r\n".to_vec());
1002-
1003- // let (mut res, _) = ServerTransaction::parse(&mut raw).unwrap().unwrap();
1004-
1005- // let link = res.headers.remove::<Link>().unwrap();
1006-
1007- // assert_eq!(link, expected_link);
1008- // }
974+ #[ test]
975+ fn test_link_multiple_link_headers ( ) {
976+ let first_link = LinkValue :: new ( "/TheBook/chapter2" )
977+ . push_rel ( RelationType :: Previous )
978+ . set_title_star ( "UTF-8'de'letztes%20Kapitel" ) ;
979+
980+ let second_link = LinkValue :: new ( "/TheBook/chapter4" )
981+ . push_rel ( RelationType :: Next )
982+ . set_title_star ( "UTF-8'de'n%c3%a4chstes%20Kapitel" ) ;
983+
984+ let third_link = LinkValue :: new ( "http://example.com/TheBook/chapter2" )
985+ . push_rel ( RelationType :: Previous )
986+ . push_rev ( RelationType :: Next )
987+ . set_title ( "previous chapter" ) ;
988+
989+ let expected_link = Link :: new ( vec ! [ first_link, second_link, third_link] ) ;
990+
991+ let link = parse_header ( & [
992+ b"</TheBook/chapter2>; rel=\" previous\" ; title*=UTF-8'de'letztes%20Kapitel, \
993+ </TheBook/chapter4>; rel=\" next\" ; title*=UTF-8'de'n%c3%a4chstes%20Kapitel",
994+ b"<http://example.com/TheBook/chapter2>; rel=\" previous\" ; rev=next; \
995+ title=\" previous chapter\" ",
996+ ] ) . unwrap ( ) ;
997+
998+ assert_eq ! ( link, expected_link) ;
999+ }
10091000
10101001 #[ test]
10111002 fn test_link_display ( ) {
0 commit comments