Topinambur Async is an extension for Topinambur
- Use the corouines a really lightweight http library
- Use an object-oriented http library
- Add JitPack in your root build.gradle at the end of repositories:
repositories {
...
maven { url 'https://jitpack.io' }
}
- Add the dependency
implementation 'com.github.DaikonWeb:topinambur:1.2.4'
implementation 'com.github.DaikonWeb:topinambur-async:1.7.0'
- Add the JitPack repository to your build file
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
- Add the dependency
<dependency>
<groupId>com.github.DaikonWeb</groupId>
<artifactId>topinambur</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>com.github.DaikonWeb</groupId>
<artifactId>topinambur-async</artifactId>
<version>1.7.0</version>
</dependency>
#### Async - Await way
runBlocking {
val response = "https://github.com/DaikonWeb".httpAsync(this).get()
println(response.await().statusCode)
}
runBlocking {
"https://github.com/DaikonWeb".httpAsync(this).get() { response ->
println(response.statusCode)
}
}
runBlocking {
HttpAsyncClient(this, "https://github.com/DaikonWeb", System.out).get().body
}