Reactive extensions for KHttp
You can install these reactive extensions using Jitpack.
Currently there is only a snapshot available as test coverage is improved.
// Project level build.gradle
// ...
repositories {
maven { url 'https://jitpack.io' }
}
// ...
// Module level build.gradle
dependencies {
// or 'compile' if in Java-land.
implementation "com.github.karn:khttp-rxjava:-SNAPSHOT"
}The most basic case is as follows:
get("http://httpbin.org/get")
.subscribe { response: Response?, error: Throwable? ->
if (error != null) {
// Handle Error here
return@subscribe
}
when (response?.statusCode) {
200 -> System.out.print("Status OK")
else -> System.out.print("Status not OK.")
}
}There are many ways to contribute, you can
- submit bugs,
- help track issues,
- review code changes.