summaryrefslogtreecommitdiff
path: root/src/http_util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/http_util.rs')
-rw-r--r--src/http_util.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/http_util.rs b/src/http_util.rs
index 09c978aa3..8c289911e 100644
--- a/src/http_util.rs
+++ b/src/http_util.rs
@@ -55,7 +55,7 @@ fn resolve_uri_from_location(base_uri: &Uri, location: &str) -> Uri {
// The CodeFetch message is used to load HTTP javascript resources and expects a
// synchronous response, this utility method supports that.
-pub fn fetch_sync_string(module_name: &str) -> DenoResult<(String, String)> {
+pub fn fetch_sync_string(module_name: &str) -> DenoResult<(Vec<u8>, String)> {
let url = module_name.parse::<Uri>().unwrap();
let client = get_client();
// TODO(kevinkassimo): consider set a max redirection counter
@@ -93,11 +93,11 @@ pub fn fetch_sync_string(module_name: &str) -> DenoResult<(String, String)> {
let body = response
.into_body()
.concat2()
- .map(|body| String::from_utf8(body.to_vec()).unwrap())
+ .map(|body| body.to_vec())
.map_err(DenoError::from);
body.join(future::ok(content_type))
- }).and_then(|(body_string, maybe_content_type)| {
- future::ok((body_string, maybe_content_type.unwrap()))
+ }).and_then(|(body_bytes, maybe_content_type)| {
+ future::ok((body_bytes, maybe_content_type.unwrap()))
});
tokio_util::block_on(fetch_future)