-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
response-transformer doesn't handle empty JSON array well #1208
Labels
Comments
#1263 fixes a bug that included decoding an encoding the body even when no body modifications were configured. So that part is fixed in de upcoming 0.9 release. |
@Tieske can we close this? |
See openresty/lua-cjson#6 for a potential fix to this |
kikito
added a commit
that referenced
this issue
Aug 13, 2019
When a response contains an empty array and it gets transformed, the empty array should remain an empty array (and not get transformed into an empty cjson object). Fixes #1208.
hishamhm
pushed a commit
that referenced
this issue
Aug 13, 2019
When a response contains an empty array and it gets transformed, the empty array should remain an empty array (and not get transformed into an empty cjson object). Fixes #1208.
I will close this as a fix to it was merged. |
hishamhm
pushed a commit
that referenced
this issue
Aug 15, 2019
When a response contains an empty array and it gets transformed, the empty array should remain an empty array (and not get transformed into an empty cjson object). Fixes #1208.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
response-tranformer by default would do response body's transformation by cjson.decode(), and later does a cjson.encode() even if no transformation to response body is required.
This uses cjson.decode() and cjson.encode() but cjson's current version from luarocks does not handle empty array well in below case:
The json_str_foo becomes:
{"items":{},"properties":{}}
instead of
'{"items":[],"properties":{}}'
as expected.This is caused by this issue from cjson: mpx/lua-cjson#11
If using response-transformer is an only choice to transform response body, this defect looks like to block some use scenarios that our services return empty array in JSON as part of the response body.
The text was updated successfully, but these errors were encountered: