You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
Fix HTTPClient.get_response_body_length() incorrect on Web
This commit is contained in:
@@ -50,17 +50,22 @@ const GodotFetch = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let chunked = false;
|
let chunked = false;
|
||||||
|
let bodySize = -1;
|
||||||
response.headers.forEach(function (value, header) {
|
response.headers.forEach(function (value, header) {
|
||||||
const v = value.toLowerCase().trim();
|
const v = value.toLowerCase().trim();
|
||||||
const h = header.toLowerCase().trim();
|
const h = header.toLowerCase().trim();
|
||||||
if (h === 'transfer-encoding' && v === 'chunked') {
|
if (h === 'transfer-encoding' && v === 'chunked') {
|
||||||
chunked = true;
|
chunked = true;
|
||||||
}
|
}
|
||||||
|
if (h === 'content-length') {
|
||||||
|
bodySize = parseInt(v, 10);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
obj.status = response.status;
|
obj.status = response.status;
|
||||||
obj.response = response;
|
obj.response = response;
|
||||||
obj.reader = response.body.getReader();
|
obj.reader = response.body.getReader();
|
||||||
obj.chunked = chunked;
|
obj.chunked = chunked;
|
||||||
|
obj.bodySize = bodySize;
|
||||||
},
|
},
|
||||||
|
|
||||||
onerror: function (id, err) {
|
onerror: function (id, err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user