|
@@ -50,22 +50,17 @@ 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) {
|
|
@@ -87,7 +82,6 @@ const GodotFetch = {
|
|
reading: false,
|
|
reading: false,
|
|
status: 0,
|
|
status: 0,
|
|
chunks: [],
|
|
chunks: [],
|
|
- bodySize: -1,
|
|
|
|
};
|
|
};
|
|
const id = IDHandler.add(obj);
|
|
const id = IDHandler.add(obj);
|
|
const init = {
|
|
const init = {
|
|
@@ -224,15 +218,6 @@ const GodotFetch = {
|
|
return p_buf_size - to_read;
|
|
return p_buf_size - to_read;
|
|
},
|
|
},
|
|
|
|
|
|
- godot_js_fetch_body_length_get__sig: 'ii',
|
|
|
|
- godot_js_fetch_body_length_get: function (p_id) {
|
|
|
|
- const obj = IDHandler.get(p_id);
|
|
|
|
- if (!obj || !obj.response) {
|
|
|
|
- return -1;
|
|
|
|
- }
|
|
|
|
- return obj.bodySize;
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
godot_js_fetch_is_chunked__sig: 'ii',
|
|
godot_js_fetch_is_chunked__sig: 'ii',
|
|
godot_js_fetch_is_chunked: function (p_id) {
|
|
godot_js_fetch_is_chunked: function (p_id) {
|
|
const obj = IDHandler.get(p_id);
|
|
const obj = IDHandler.get(p_id);
|