@@ -5,16 +5,16 @@ use async_std::prelude::*;
55use async_std:: task:: { Context , Poll } ;
66use futures_core:: ready;
77use http_types:: {
8- headers:: { HeaderName , HeaderValue , CONTENT_LENGTH , TRANSFER_ENCODING , DATE } ,
8+ headers:: { HeaderName , HeaderValue , CONTENT_LENGTH , DATE , TRANSFER_ENCODING } ,
99 Body , Request , Response , StatusCode ,
1010} ;
1111
1212use std:: pin:: Pin ;
1313use std:: str:: FromStr ;
1414
1515use crate :: chunked:: ChunkedDecoder ;
16- use crate :: error:: HttpError ;
1716use crate :: date:: fmt_http_date;
17+ use crate :: error:: HttpError ;
1818use crate :: { Exception , MAX_HEADERS } ;
1919
2020/// An HTTP encoder.
@@ -80,7 +80,7 @@ pub async fn encode(req: Request) -> Result<Encoder, std::io::Error> {
8080 }
8181
8282 let date = fmt_http_date ( std:: time:: SystemTime :: now ( ) ) ;
83- buf. write_all ( b"Date : " ) . await ?;
83+ buf. write_all ( b"date : " ) . await ?;
8484 buf. write_all ( date. as_bytes ( ) ) . await ?;
8585 buf. write_all ( b"\r \n " ) . await ?;
8686
@@ -145,9 +145,7 @@ where
145145
146146 if res. header ( & DATE ) . is_none ( ) {
147147 let date = fmt_http_date ( std:: time:: SystemTime :: now ( ) ) ;
148- buf. write_all ( b"Date: " ) . await ?;
149- buf. write_all ( date. as_bytes ( ) ) . await ?;
150- buf. write_all ( b"\r \n " ) . await ?;
148+ res. insert_header ( DATE , & format ! ( "date: {}\r \n " , date) [ ..] ) ?;
151149 }
152150
153151 let content_length = res. header ( & CONTENT_LENGTH ) ;
0 commit comments