-
Notifications
You must be signed in to change notification settings - Fork 885
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
Command with query parameter reports unrecognized parameter in DevTools #3813
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #3813 +/- ##
=======================================
Coverage 66.41% 66.42%
=======================================
Files 3209 3209
Lines 61730 61732 +2
Branches 9533 9533
=======================================
+ Hits 41000 41004 +4
+ Misses 18442 18440 -2
Partials 2288 2288
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
if (urlPath.includes('?')) { | ||
urlPath += '&pretty=true'; | ||
} else { | ||
urlPath += '?pretty=true'; | ||
} |
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 @Hailong-am for submitting the issue and post PR to fix!
What do you think of rewriting this toUrlPath()
function to the below code? I think this will handle most corner cases.
function toUrlPath(path: string) {
const FAKE_BASE = 'http://localhost';
const urlWithFakeBase = new URL(`${FAKE_BASE}/${trimStart(path, '/')}`);
// Appending pretty here to have OpenSearch do the JSON formatting, as doing
// in JS can lead to data loss (7.0 will get munged into 7, thus losing indication of
// measurement precision)
if (!urlWithFakeBase.searchParams.get('pretty')) {
urlWithFakeBase.searchParams.append('pretty', 'true');
}
const urlPath = urlWithFakeBase.href.replace(urlWithFakeBase.origin, '');
return urlPath;
}
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.
this looks much better and clear, update the change by your suggestion.
Signed-off-by: Hailong Cui <ihailong@amazon.com>
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 the change, lgtm!
@kristenTian would you give a second review? |
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.
LGTM. Will wait for windows CI check failures to pass before merging.
Signed-off-by: Hailong Cui <ihailong@amazon.com> (cherry picked from commit e12ae0b) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
Signed-off-by: Hailong Cui <ihailong@amazon.com> (cherry picked from commit e12ae0b) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…ject#3813) Signed-off-by: Hailong Cui <ihailong@amazon.com> Signed-off-by: David Sinclair <david@sinclair.tech>
Description
check whether the command has a query parameter or not first, if it has, then append
&pretty=true
instead of?pretty=true
Issues Resolved
#3812
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr