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

RouteOptions.toUrl migrate to url library #1313

Closed
RingerJK opened this issue Oct 29, 2021 · 0 comments · Fixed by #1314
Closed

RouteOptions.toUrl migrate to url library #1313

RingerJK opened this issue Oct 29, 2021 · 0 comments · Fixed by #1314
Assignees

Comments

@RingerJK
Copy link
Contributor

RouteOptions.toUrl is not sensitive to corner cases (if you set to baseUrl URL which is ended on / -> youget an problem with incorrect request)

We need to migrate to URL-library which already applies all corner cases under the hood

public URL toUrl(@NonNull String accessToken) {
StringBuilder sb = new StringBuilder()
.append(baseUrl())
.append("/directions/v5")
.append(String.format("/%s", user()))
.append(String.format("/%s", profile()))
.append(String.format("/%s", coordinates()))
.append(String.format("?access_token=%s", accessToken))
.append(String.format("&geometries=%s", geometries()));
if (alternatives() != null) {
sb.append(String.format("&alternatives=%s", alternatives()));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants