lua-resty-reqargs
lua-resty-reqargs copied to clipboard
Lib only works for GET args
https://github.com/bungle/lua-resty-reqargs/blob/master/lib/resty/reqargs.lua#L86
ngx.var.content_type
seems to always be nil.
Good catch! Thanks!
@lordnynex I submitted one patch, is this: https://github.com/bungle/lua-resty-reqargs/commit/b023f4c7cc83ba699b3c6c8924943144cbffc4dd
what you were looking at?
What comes to this: http://nginx.org/en/docs/http/ngx_http_core_module.html#var_content_type
aka $content_type
being always nil
. That seems strange if you do pass the Content-Type
header.
@bungle I'm realizing that this bug is weird and probably invalid. For whatever reason it's always nil in my tests outside of reqargs. But the issue that caused me to dive into the code to see why post was not populated was my own stupid issue where I was posting invalid JSON.
Long story short, I think you can close this bug as invalid, because the lib appears to work. The line I linked, if it was a valid bug, means POST would never work regardless of content type. I'm a little stumped here.
@lordnynex, great, but I think you pointed me to one obvious flaw (not related to your issue). Have you checked the latest master, and if yes, does it cause any problems. I mean, should I still revert to the old code. It feels that the original code was a bit opinionated. But the commit I made is not 100% bc compatible. I still it right thing to do (e.g. not to default application/x-www-form-urlencoded
unless asked for it. It is the most common way to send parameters though).