-
Notifications
You must be signed in to change notification settings - Fork 127
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
Standardize arrays and objects in querystring #2342
Conversation
Codecov Report
@@ Coverage Diff @@
## 2-dev #2342 +/- ##
=======================================
Coverage 91.50% 91.50%
=======================================
Files 118 118
Lines 8064 8064
=======================================
Hits 7379 7379
Misses 685 685
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm quite a fan of this addition but for the sake of backwards compatibility, I would tend to do the opposite:
- Keep the old behavior for
getObject
andgetArray
. - Create two new functions with the new behavior
I'm not sure to understand why would you do that ? |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
What does this PR do ?
request.getArray
andrequest.getObject
are now able to retrieve array and object from the query parameters.Example of process for
request.getArray
:The same process applies for
getObject
Documentation on this behaviour has been added
There was some controller or pipe process that where splitting strings on
,
to obtain arrays, a new method has been added to the request object namedgetArrayLegacy
, this method exist to ensure retrocompatibility, the method is deprecated and should not be used.getArrayLegacy
behaves pretty much likegetArray
but instead of throwing if the string cannot be parsed as a JSON Arraythe string is simply splitted each time a
,
is encountered, to keep retrocompatibility.getArrayLegacy
process:,
,
Tests have been added to cover this new cases
How should this be manually tested?
npm run test
Other changes
There was an undetected bug where calling
getBodyBoolean
in an HTTP Request was not returning the value of the field in the body but was returningtrue
orfalse
if the field was present or not.This is now fixed.