http icon indicating copy to clipboard operation
http copied to clipboard

POST parameters are not decoded properly

Open knazarov opened this issue 8 years ago • 2 comments

I'm using req.param() to extract POST request params, but it's not working at all.

Here's what I do:

echo '{"text": "Hello **world**!"}' | curl -d @- http://localhost:8080/

Then in tarantool I print the request as follows:

print(yaml.encode(req:param()))

Then I get this:

---
'{"text": "Hello **world**!"}':
...

If I try to get the "text" parameter using req:param("text"), it returns nil

knazarov avatar Feb 22 '17 12:02 knazarov

This works:

http POST localhost:8083/api/rules code=='print("foo")' foo==bar

This doesn't:

http POST localhost:8083/api/rules code='print("foo")' foo=bar

knazarov avatar Feb 22 '17 12:02 knazarov

It is the same for req:post_param(name). It returns nil for every name. Although req:json() produces valid json from which it is possible to get parameter.

Muzicius avatar Feb 25 '17 19:02 Muzicius