use Array when converting bytes into JsValue (#1341)
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
use super::multipart::Form;
|
use super::multipart::Form;
|
||||||
/// dox
|
/// dox
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use js_sys::Uint8Array;
|
use js_sys::{Array, Uint8Array};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use wasm_bindgen::JsValue;
|
use wasm_bindgen::JsValue;
|
||||||
|
|
||||||
@@ -28,7 +28,9 @@ impl Body {
|
|||||||
match &self.inner {
|
match &self.inner {
|
||||||
Inner::Bytes(body_bytes) => {
|
Inner::Bytes(body_bytes) => {
|
||||||
let body_bytes: &[u8] = body_bytes.as_ref();
|
let body_bytes: &[u8] = body_bytes.as_ref();
|
||||||
let body_array: Uint8Array = body_bytes.into();
|
let body_uint8_array: Uint8Array = body_bytes.into();
|
||||||
|
let body_array = Array::new();
|
||||||
|
body_array.push(&body_uint8_array);
|
||||||
let js_value: &JsValue = body_array.as_ref();
|
let js_value: &JsValue = body_array.as_ref();
|
||||||
Ok(js_value.to_owned())
|
Ok(js_value.to_owned())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user