second-state / wasmedge-quickjs

A high-performance, secure, extensible, and OCI-complaint JavaScript runtime for WasmEdge.
Apache License 2.0
477 stars 59 forks source link

httpx.Buffer byteLength binding #102

Open Wonshtrum opened 1 year ago

Wonshtrum commented 1 year ago

fetch wasn't working in my scripts because the Buffer of the Response had no byteLength. I looked at the code and find out that the Rust Buffer struct exposes js_length as length attribute: https://github.com/second-state/wasmedge-quickjs/blob/2deecb889750c45b024be62637e6305aeb79190c/src/internal_module/httpx/js_module.rs#L160 but byteLength is used instead on the JS object: https://github.com/second-state/wasmedge-quickjs/blob/2deecb889750c45b024be62637e6305aeb79190c/modules/http.js#L114