luvit/luvit

There is no body in http request

mawesome4ever opened this issue · 2 comments

I have the following code:

http.createServer(function (req, res)
    print(req.body)
}

but it returns nil. After looping through req i see the follow:
image

As you may see, there's no body. Also, what's with the documentation not having any descriptions of anything or at least any examples? https://luvit.io/api/http.html

luvit's builtin http library is a port of the nodejs http library, which is almost entirely callback oriented. To get the request body you need to use req:on('data', fn) and req:on('end', fn) to capture (and probably buffer) the request body.

As for the other question: the luvit documentation is not maintained whatsoever and most things just don't have documentation.

Oh that makes sense! Just looked at nodejs wiki page and it helped, thanks!