Skip to content

Latest commit

 

History

History
79 lines (65 loc) · 1.6 KB

README.md

File metadata and controls

79 lines (65 loc) · 1.6 KB

Topinambur Async

Topinambur

Topinambur Async is an extension for Topinambur

  • Use the corouines a really lightweight http library
  • Use an object-oriented http library

How to add Topinambur Async to your project

Gradle

  • 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'

Maven

  • 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>

Getting Started

#### Async - Await way

runBlocking {
    val response = "https://github.com/DaikonWeb".httpAsync(this).get()

    println(response.await().statusCode)
}

Launch way

runBlocking {
    "https://github.com/DaikonWeb".httpAsync(this).get() { response ->
        println(response.statusCode)
    }
}

Enable request logging as Curl

runBlocking { 
    HttpAsyncClient(this, "https://github.com/DaikonWeb", System.out).get().body
}