Cương Nguyễn
10/13/2024, 4:13 PMAleksei Tirman [JB]
10/14/2024, 8:55 AMResource
annotation accepts a path, not a full URL. You can use the DefaultRequest plugin to set the default URL for all requests.Cương Nguyễn
10/14/2024, 2:04 PMAleksei Tirman [JB]
10/14/2024, 6:27 PMHttpRequestBuilder
for each request to set the appropriate host. Here is an example:
@Resource("/get")
class Get()
suspend fun main() {
val client = HttpClient(CIO) {
install(Resources)
}
val response = client.get(Get()) {
url {
protocol = URLProtocol.HTTPS
host = "httpbin.org"
}
}
println(response.bodyAsText())
}
Cương Nguyễn
10/19/2024, 12:12 PM