Skip to content

Latest commit

 

History

History
66 lines (50 loc) · 1.41 KB

README.md

File metadata and controls

66 lines (50 loc) · 1.41 KB

http-client-common

DEPRECATION NOTICE

This repository is outdated. Multiplatform client is included in ktor from version from 0.9.4.

Updated samples located here: https://github.com/ktorio/ktor-samples/tree/master/mpp/client-mpp

Description

Kotlin multiplatform http client

val client = HttpClient()

promise {
    client.request {
        url.apply {
            protocol = URLProtocol.HTTPS
            host = "https://en.wikipedia.org"
            encodedPath = "/wiki/Kotlin_(programming_language)"
            port = 443
        }
    }
}.then {
    println(it.body)
}

Dependencies

  1. Kotlin native compiler version: 0.8

Gradle

buildscript {
    ext.http_client_version = '0.1.15'
}

repositories {
    maven { url 'https://dl.bintray.com/e5l/http-client-common' }
}

dependencies {
    // common
    compile "io.ktor.common.client:common:$http_client_version"

    // javascript(browser)
    compile "io.ktor.common.client:browser:$http_client_version"

    // jvm + android
    compile "io.ktor.common.client:jvm:$http_client_version"
    
    // ios
    implementation "io.ktor.common.client:ios:$http_client_version"
}
// enable gradle metadata in settings.gradle
enableFeaturePreview('GRADLE_METADATA')

Samples

  1. ios
  2. android
  3. js(browser)