Closed dills122 closed 3 years ago
The request body is provided on stdin. Not sure what the idiom is in AS for reading that I'm afraid.
I was able to figure it out. It looks like it was due to the as-wasi
version being out of date and an issue with reading from Stdin
in that version.
Once I upgraded both as-wasi
and assemblyscript
to latest I was able to read the request body with the following:
const reqBody= Descriptor.Stdin.readString();
Console.log(defstr(reqBody, "EMPTY"));
Thread with some info on it https://github.com/bytecodealliance/wasmtime/issues/2373
I started playing around with some of the example repos that are available, specifically the
AssemblyScript
one, and was wondering if there was a way to pull data from the body of a request like the example below or would you need to send the data in via query parameters?It looks like the
CONTENT_LENGTH
is updated correctly, but I dont see an env var available for request body data.