diff options
Diffstat (limited to 'ext/fetch/lib.rs')
-rw-r--r-- | ext/fetch/lib.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs index 20db7abbc..3988acf9e 100644 --- a/ext/fetch/lib.rs +++ b/ext/fetch/lib.rs @@ -361,6 +361,7 @@ pub struct FetchResponse { headers: Vec<(ByteString, ByteString)>, url: String, response_rid: ResourceId, + content_length: Option<u64>, } #[op] @@ -391,6 +392,8 @@ pub async fn op_fetch_send( res_headers.push((key.as_str().into(), val.as_bytes().into())); } + let content_length = res.content_length(); + let stream: BytesStream = Box::pin(res.bytes_stream().map(|r| { r.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err)) })); @@ -409,6 +412,7 @@ pub async fn op_fetch_send( headers: res_headers, url, response_rid: rid, + content_length, }) } |