Skip to content
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

#13938 Remove slash when appended to map key in REST call #16688

Merged
merged 6 commits into from
Mar 5, 2020

Conversation

ryanlindeborg
Copy link
Contributor

@ryanlindeborg ryanlindeborg commented Feb 26, 2020

This PR removes the ending slash in the uri when it is appended to a key in a REST API call to put a key-value pair to a map.

Fixes: #13938

@devOpsHazelcast
Copy link
Collaborator

Can one of the admins verify this patch?

@mmedenjak mmedenjak added this to the 4.1 milestone Feb 27, 2020
@Holmistr
Copy link
Contributor

@ryanlindeborg Thanks for the PR! 🎉 As discussed here: #13938 (comment) , we'll wait with the reviews until you check the other places. Thanks a lot, looking forward to it!

@mmedenjak mmedenjak requested review from leszko and kwart March 3, 2020 07:36
Copy link
Member

@kwart kwart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to see a new committer here.

To be honest, I'm not sure if we need the change. IIUC, after this change we allow slash within the key, but not at the end (or it has to be doubled). Still, as I don't have a strong opinion what's the correct approach here, I'm ready to approve and merge once the comments are covered.

I think we'll need to comment on the URL processing in the Reference manual.

* @param str
* @return the string with trailing slash removed
*/
public static String stripTrailingSlash(String str) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to cover the util method with tests.

* @return the string with trailing slash removed
*/
public static String stripTrailingSlash(String str) {
if (str.charAt(str.length() - 1) == '/') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty Strings and null values can fail here.

@ryanlindeborg
Copy link
Contributor Author

Thanks for the feedback @kwart ! Should I be updating the hazelcast-reference-manual repository to detail the changes from this ticket?

@kwart
Copy link
Member

kwart commented Mar 4, 2020

Thanks for the feedback @kwart ! Should I be updating the hazelcast-reference-manual repository to detail the changes from this ticket?

If you are able to cover the behavior in the reference manual too, it would be great. Thanks.

@Holmistr
Copy link
Contributor

Holmistr commented Mar 4, 2020

@ryanlindeborg Looks great!

Regarding the reference manual, here's the repository: https://github.com/hazelcast/hazelcast-reference-manual . Could you please send a PR to the relevant sections to make sure the documentaiton is inline with your changes?

One last thing - before we merge the PR, could I ask you to sign our Contributor's agreement?
https://hazelcast.atlassian.net/wiki/spaces/COM/pages/6357071/Hazelcast+Contributor+Agreement

@ryanlindeborg
Copy link
Contributor Author

@Holmistr Submitted my PR to the reference manual repository! And I believe I sent in my Contributor's agreement a few days ago

@Holmistr
Copy link
Contributor

Holmistr commented Mar 5, 2020

@ryanlindeborg You're absolutely right, I'm just blind! In that case there's nothing more to do here, let merge the PR. Welcome to Hazelcast community family 🍻 and thank you very much for your contribution! 🎉

@Holmistr Holmistr merged commit 54e1f2e into hazelcast:master Mar 5, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

REST API requires that the URL always end with a slash
5 participants