You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
POST with body results in "TypeError: Cannot read property 'lengthComputable' of undefined" because XMLHttpRequestUpload doesn't have _properties.
Sample Code
consthttp=require('http');constXMLHttpRequest=require('w3c-xmlhttprequest').XMLHttpRequest;constserver=http.createServer((req,res)=>{res.end();});server.on('clientError',(err,socket)=>{socket.end('HTTP/1.1 400 Bad Request\r\n\r\n');});server.listen(8000);constclient=newXMLHttpRequest();client.open("POST","http://localhost:8000");client.send("abcdefg");
Result
~/src/node-xmlhttprequest/lib/xmlhttprequest.js:129
lengthComputable: _properties.lengthComputable,
^
TypeError: Cannot read property 'lengthComputable' of undefined
at Socket.<anonymous> (/home/takuo/src/node-xmlhttprequest/lib/xmlhttprequest.js:129:36)
at emitOne (events.js:82:20)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:110:10)
at TCP.onread (net.js:523:20)
Summary
POST
with body results in "TypeError: Cannot read property 'lengthComputable' of undefined" becauseXMLHttpRequestUpload
doesn't have_properties
.Sample Code
Result
Version
2.1.0 and master (383319c)
Cause
_setDispatchProgressEvents
readthis._properties
whilethis
is bound toXMLHttpRequest#upload
which doesn't have_properties
.Possible Fix
Defining
_properties
onXMLHttpRequestUpload
.The text was updated successfully, but these errors were encountered: