Skip to content

Add new splitQuery API accepting Ktor Url or string#2931

Open
Luna712 wants to merge 1 commit into
recloudstream:masterfrom
Luna712:splitquery-api
Open

Add new splitQuery API accepting Ktor Url or string#2931
Luna712 wants to merge 1 commit into
recloudstream:masterfrom
Luna712:splitquery-api

Conversation

@Luna712

@Luna712 Luna712 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@fire-light42 fire-light42 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It works well from testing and the code looks good 👍

I just have a thought regarding the new API surface. This is not blocking. I just want to hear what you think before merging this.

* // returns {"foo": "bar", "baz": "qux"}
*/
@Prerelease
fun splitQuery(url: Url): Map<String, String> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would prefer to keep the API-surface somewhat dependency-agnostic. There is no need to make the same mistake as splitQuery(url: java.net.URL) again, when we can just expose a string argument instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What I was aiming for was to expose a way to accept a direct URL as well as String. By passing a URL it can sometimes be a bit more type safe as well, and also as we shift towards ktor URL more, sometimes a URL may be wanted directly, in which case, I just thought it was better and more straightforward to accept a URL with a separate convenience method accepting a string only as well. I am open to changes though if you think it should be done differently?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am kinda considering whether this should instead be an extension function on String in StringUtils though, in which case it would make a little more sense to simply drop the URL overload and just accept that extension method. I am honestly not 100% sure on the best option here...

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 this pull request may close these issues.

2 participants