- Notifications
You must be signed in to change notification settings - Fork 233
Issue 291 - Changed parse path function considering nested query parameters. #306
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
Conversation
…equals sign considering nested queries. Added comments to query functions
…placing ternary condition with if else
Co-authored-by: Mustafa Zengin <muzengin@microsoft.com>
| These changes work for me, except for the edge case pointed by @zengin. I have a few suggestions regarding improving the code's readability.
What do you think of extracting the changes added to query() in a separate function then call the extracted function in parsePath() and query()? |
src/GraphRequest.ts Outdated
| if (queryDictionaryOrString.hasOwnProperty(key)) { | ||
| otherURLQueryParams[key] = queryDictionaryOrString[key]; | ||
| paramKey = key; | ||
| paramValue = queryDictionaryOrString[key]; |
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.
shouldn't there be a break here? if not can you add a comment about the intent of the code here. once paramKey is set it's not clear why continue
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.
It was a mistake on my part. Corrected the code so that the iteration records key and value for each parameter in the dictionary.
src/GraphRequest.ts Outdated
| * @public | ||
| * Appends query string to the urlComponent | ||
| * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query value | ||
| * @returns The same GraphRequest instance that is being called with |
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.
can you comment here on what the modification the graphrequest is. It currently reads like I passed in something and got the same thing back.
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.
Added more information in some comments. There are more comments like this one. Will change them in another PR.
I have added a private function which is called by parsePath() and query() function. I have tried using variables in place of expressions wherever the expression appears more than once. And tried breaking down to small functions. |
…g the GraphRequest instance
zengin left a comment
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.
Thanks for taking a test centric approach for this fix.
URL parsing failed because the parsePath() function did not considering nested query functions. Changed the function to split the query parameters on the first equals sign( OData Parsing rules).
Also, added comments to few query option functions mentioning their expected behaviour.