-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: res:json() is nil #29
Comments
@whatwewant Maybe I didn't catch your mean. Could you provide some cases to show me the problem? It seems good to me for the detection of Content-Type, is there any provision about the value of Content-Type? |
Some servers provide Content-Type: application/json;charset=utf-8, such as coding.net some apis, this will caused json() == nil |
and another, i think it better to validate two thing here
|
@whatwewant |
Well, I see. this issue is to solve json first. I also found pythons requests parses json at https://github.com/psf/requests/blob/eedd67462819f8dbf8c1c32e77f9070606605231/requests/models.py#L921 . |
About encoding, I will try to make it solved like python. |
I also see json parse method do the same as python requests |
lua-resty-requests/lib/resty/requests/response.lua
Line 315 in ff1309a
lua-resty-requests/lib/resty/requests/response.lua
Line 316 in ff1309a
I found the bug is caused by the code, fixed ContentType values, it should using regular expression to detect the validity of ContentType
The text was updated successfully, but these errors were encountered: