URLBuilder

interface URLBuilder

一个用于以编程方式构建或修改 URL 的构建器。

Author

M8Test, [email protected], https://m8test.com

Functions

Link copied to clipboard
abstract fun appendPathSegments(pathSegments: List<String>): URLBuilder

向 URL 的路径部分追加一个或多个路径段。 例如,在 http://example.com/api 上调用 appendPathSegments(listOf("v1", "users")) 将得到 `http://example.com/api/v1/users`。

Link copied to clipboard
abstract fun appendQueryParameter(name: String, value: String)

向 URL 添加一个查询参数(query string)。 如果已存在同名参数,此方法通常会追加一个新的值。

Link copied to clipboard
abstract fun setFragment(value: String)

设置 URL 的片段(fragment)部分,即 # 符号后面的内容。