emscripten-core / emscripten-core/emscripten

NodeJs XMLHttpRequest response property is undefined

Open
#21,158 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

I make fetch from wasm to a remote http server using emscripten fetchapi when use my module from react app it works fine
when I compile for nodejs I should install xmlhttprequest library because nodejs dont have natively this library so I debug when make request and my fetch response is drop this function in module.js

function saveResponseAndStatus() {
var ptr = 0;
var ptrLen = 0;
if (xhr.response && fetchAttrLoadToMemory && HEAPU32[fetch + 12 >> 2] === 0) {
ptrLen = xhr.response.byteLength;
}
.
.
.

xhr.response is undefined but my xhr.responseText has value so in this if check xhr.response seen undefined and code cant read ptrlen and I dont see my result in the end .

I think the problem is about xmlhttprequest lib in nodeJs its not same with browser xmlhttprequest lib
what should I do ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.