Skip to content

fix(retrofit2): fix baseUrl must end in / error #1476

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

Merged
merged 3 commits into from
Feb 27, 2025

Conversation

kirangodishala
Copy link
Contributor

Retrofit2 client configuration doesn't allow baseUrl without tailing slash(/) if there is a slash in the middle. As a result https://somehost and https://somehost:3333 becomes valid but https://somehost/api throws java.lang.IllegalArgumentException: baseUrl must end in /.

This PR addresses the issue by checking and adding trailing / if missing and removing the leading / from the endpoint.

…aseUrl and removing leading / in the end point:

java.lang.IllegalArgumentException: baseUrl must end in /.
@kirangodishala kirangodishala force-pushed the retrofit2-url-fix branch 2 times, most recently from d7e1a63 to 36460da Compare February 26, 2025 19:43
… and add a test class to demonstrate the behaviour.

Here are some references that justify this change:
square/retrofit#907,
square/retrofit#1701
@dbyron-sf dbyron-sf added the ready to merge Approved and ready for merge label Feb 27, 2025
@mergify mergify bot added the auto merged label Feb 27, 2025
@mergify mergify bot merged commit 19e2f34 into spinnaker:master Feb 27, 2025
5 checks passed
@dbyron-sf
Copy link
Contributor

@Mergifyio backport release-1.37.x

Copy link
Contributor

mergify bot commented Feb 27, 2025

backport release-1.37.x

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Feb 27, 2025
* test(retrofit2): add a test to demonstrate the error: java.lang.IllegalArgumentException: baseUrl must end in /.

* fix(retrofit2): fix the following error by adding trailing / in the baseUrl and removing leading / in the end point:
java.lang.IllegalArgumentException: baseUrl must end in /.

* fix(retrofit2): fix RestService by replacing POST mapping from / to . and add a test class to demonstrate the behaviour.

Here are some references that justify this change:
square/retrofit#907,
square/retrofit#1701

(cherry picked from commit 19e2f34)
mergify bot added a commit that referenced this pull request Feb 27, 2025
* test(retrofit2): add a test to demonstrate the error: java.lang.IllegalArgumentException: baseUrl must end in /.

* fix(retrofit2): fix the following error by adding trailing / in the baseUrl and removing leading / in the end point:
java.lang.IllegalArgumentException: baseUrl must end in /.

* fix(retrofit2): fix RestService by replacing POST mapping from / to . and add a test class to demonstrate the behaviour.

Here are some references that justify this change:
square/retrofit#907,
square/retrofit#1701

(cherry picked from commit 19e2f34)

Co-authored-by: Kiran Godishala <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged ready to merge Approved and ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants