@@ -498,28 +498,32 @@ impl<'a> FromIterator<HeaderView<'a>> for Headers {
498
498
impl < ' a > fmt:: Display for & ' a ( HeaderFormat + Send + Sync ) {
499
499
#[ inline]
500
500
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
501
- ( * * self ) . fmt_header ( f)
501
+ let mut multi = MultilineFormatter ( Multi :: Join ( true , f) ) ;
502
+ self . fmt_multi_header ( & mut multi)
502
503
}
503
504
}
504
505
505
506
/// A wrapper around any Header with a Display impl that calls fmt_header.
506
507
///
507
508
/// This can be used like so: `format!("{}", HeaderFormatter(&header))` to
508
- /// get the representation of a Header which will be written to an
509
- /// outgoing `TcpStream`.
509
+ /// get the 'value string' representation of this Header.
510
+ ///
511
+ /// Note: This may not necessarily be the value written to stream, such
512
+ /// as with the SetCookie header.
510
513
pub struct HeaderFormatter < ' a , H : HeaderFormat > ( pub & ' a H ) ;
511
514
512
515
impl < ' a , H : HeaderFormat > fmt:: Display for HeaderFormatter < ' a , H > {
513
516
#[ inline]
514
517
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
515
- self . 0 . fmt_header ( f)
518
+ let mut multi = MultilineFormatter ( Multi :: Join ( true , f) ) ;
519
+ self . 0 . fmt_multi_header ( & mut multi)
516
520
}
517
521
}
518
522
519
523
impl < ' a , H : HeaderFormat > fmt:: Debug for HeaderFormatter < ' a , H > {
520
524
#[ inline]
521
525
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
522
- self . 0 . fmt_header ( f)
526
+ fmt :: Display :: fmt ( self , f)
523
527
}
524
528
}
525
529
0 commit comments