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

Hardcoded "/api/v1" path prefix #35

Closed
bocops opened this issue Dec 20, 2022 · 0 comments · Fixed by #47
Closed

Hardcoded "/api/v1" path prefix #35

bocops opened this issue Dec 20, 2022 · 0 comments · Fixed by #47
Assignees
Labels
code quality Everything related to code quality

Comments

@bocops
Copy link
Collaborator

bocops commented Dec 20, 2022

The path prefix to "api/v1" is currently hardcoded in MastodonClient.kt. This will be problematic once V2 endpoints need to be added, but is already an issue for the OAuth endpoints that aren't located under "/api".

The current workaround is to offer a separate postUrl(String, Parameter) method that interprets its string input as a full URL, whereas post(String, Parameter) interprets its input as additional path segments under "api/v1". Both the fact that the two methods have an identical signature and the fact that there's no check on whether the full URL even uses the same host as defined as instanceName can lead to issues down the line.

This could be solved by moving the full path to each endpoint out of MastodonClient and into each of its callers. At the same time, building the final URLs can be moved from doing it ourselves to using okHttp.HttpUrl and its builder throughout, which might prevent more bugs from happening.

I'm already working on the OkHttp part of #5, so I could tackle this in the process.

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

Successfully merging a pull request may close this issue.

2 participants