File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33use crate :: io:: { AsyncInputStream , AsyncRead , Cursor , Empty } ;
44use core:: fmt;
5+ use http:: header:: { CONTENT_LENGTH , TRANSFER_ENCODING } ;
56use wasi:: http:: types:: IncomingBody as WasiIncomingBody ;
67
78pub use super :: {
@@ -17,13 +18,13 @@ pub(crate) enum BodyKind {
1718
1819impl BodyKind {
1920 pub ( crate ) fn from_headers ( headers : & HeaderMap ) -> Result < BodyKind , InvalidContentLength > {
20- if let Some ( value) = headers. get ( "content-length" ) {
21+ if let Some ( value) = headers. get ( CONTENT_LENGTH ) {
2122 let content_length = std:: str:: from_utf8 ( value. as_ref ( ) )
2223 . unwrap ( )
2324 . parse :: < u64 > ( )
2425 . map_err ( |_| InvalidContentLength ) ?;
2526 Ok ( BodyKind :: Fixed ( content_length) )
26- } else if headers. contains_key ( "transfer-encoding" ) {
27+ } else if headers. contains_key ( TRANSFER_ENCODING ) {
2728 Ok ( BodyKind :: Chunked )
2829 } else {
2930 Ok ( BodyKind :: Chunked )
You can’t perform that action at this time.
0 commit comments