fix handling of request bodies

This commit is contained in:
ading2210 2024-03-20 18:38:13 -04:00
parent 3a50060e07
commit 5e9f26f818
6 changed files with 32 additions and 8 deletions

View file

@ -77,10 +77,15 @@ function data_to_array(data) {
function c_func(target, args=[]) {
let str_pointers = [];
for (let i = 0; i < args.length; i++) {
if (typeof args[i] !== "string") {
continue;
let ptr = null;
if (typeof args[i] === "string") {
ptr = allocate_str(args[i]);
}
let ptr = allocate_str(args[i]);
if (args[i] instanceof Uint8Array) {
ptr = allocate_array(args[i]);
}
if (!ptr) continue;
args[i] = ptr;
str_pointers.push(ptr);
}