File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
use crate :: io:: { AsyncInputStream , AsyncRead , Cursor , Empty } ;
4
4
use core:: fmt;
5
+ use http:: header:: { CONTENT_LENGTH , TRANSFER_ENCODING } ;
5
6
use wasi:: http:: types:: IncomingBody as WasiIncomingBody ;
6
7
7
8
pub use super :: {
@@ -17,13 +18,13 @@ pub(crate) enum BodyKind {
17
18
18
19
impl BodyKind {
19
20
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 ) {
21
22
let content_length = std:: str:: from_utf8 ( value. as_ref ( ) )
22
23
. unwrap ( )
23
24
. parse :: < u64 > ( )
24
25
. map_err ( |_| InvalidContentLength ) ?;
25
26
Ok ( BodyKind :: Fixed ( content_length) )
26
- } else if headers. contains_key ( "transfer-encoding" ) {
27
+ } else if headers. contains_key ( TRANSFER_ENCODING ) {
27
28
Ok ( BodyKind :: Chunked )
28
29
} else {
29
30
Ok ( BodyKind :: Chunked )
You can’t perform that action at this time.
0 commit comments