Kotlin DSL http client


License

License

GroupId

GroupId

io.github.rybalkinsd
ArtifactId

ArtifactId

kohttp
Last Version

Last Version

0.12.0
Release Date

Release Date

Type

Type

jar
Description

Description

Kotlin DSL http client
Kotlin DSL http client
Project URL

Project URL

https://github.com/rybalkinsd/kohttp
Project Organization

Project Organization

io.github.rybalkinsd
Source Code Management

Source Code Management

https://github.com/rybalkinsd/kohttp

Download kohttp

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.rybalkinsd/kohttp/ -->
<dependency>
    <groupId>io.github.rybalkinsd</groupId>
    <artifactId>kohttp</artifactId>
    <version>0.12.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.rybalkinsd/kohttp/
implementation 'io.github.rybalkinsd:kohttp:0.12.0'
// https://jarcasting.com/artifacts/io.github.rybalkinsd/kohttp/
implementation ("io.github.rybalkinsd:kohttp:0.12.0")
'io.github.rybalkinsd:kohttp:jar:0.12.0'
<dependency org="io.github.rybalkinsd" name="kohttp" rev="0.12.0">
  <artifact name="kohttp" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.rybalkinsd', module='kohttp', version='0.12.0')
)
libraryDependencies += "io.github.rybalkinsd" % "kohttp" % "0.12.0"
[io.github.rybalkinsd/kohttp "0.12.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.jetbrains.kotlinx : kotlinx-coroutines-core jar 1.2.1
com.squareup.okhttp3 : okhttp jar 3.14.2

runtime (1)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.3.50

Project Modules

There are no modules declared in this project.

Introduction

Build Status Maven Central codecov Codacy Badge Kotlin Awesome Kotlin Badge Join the chat at https://gitter.im/kohttp/communitystar this repo

Kotlin DSL http client

Features

๐Ÿ”น Developers Experience-driven library without verbosity.

๐Ÿ”น Native way to use http client in Kotlin.

๐Ÿ”น HTTP GET/POST/PUT/HEAD/DELETE/PATCH requests.

๐Ÿ”น Asynchronous and blocking requests.

๐Ÿ”น Upload files.

๐Ÿ”น Logging - easily dump your http requests or convert them to cURL commands.

๐Ÿ”น Minimal footprint.

Quick start

// Use String or URL extensions send simple request
val response = "https://my-host.com/users?admin=true".httpGet()

// Parse response with your favorite library
val users = response.toJson()

// Use sync or async methods to send your requests
// Configure method params, headers, cookies and body in a concise way
val notifications: List<Deferred<Response>> = users.forEach { user ->
    httpPostAsync {
        url("https://my-host.com/friends/push")
        
        param {
            "userId" to user[id]
            "eventType" to NewFriend
        }
        
        header {
            "locale" to "en_EN"
            cookie {
                "user_session" to "toFycNV"
                "authToken" to "d2dwa6011w96c93ct3e3493d4a1b5c8751563217409"
            }
        }
    }
}

Samples

About kohttp

Installation

Gradle

Kotlin DSL:

implementation(group = "io.github.rybalkinsd", name = "kohttp", version = "0.12.0")

Groovy DSL:

implementation 'io.github.rybalkinsd:kohttp:0.12.0'

Maven:

<dependency>
  <groupId>io.github.rybalkinsd</groupId>
  <artifactId>kohttp</artifactId>
  <version>0.12.0</version>
</dependency>

Table of contents

Versions

Version
0.12.0
0.11.1
0.11.0
0.10.0
0.9.0
0.8.0
0.7.1
0.7.0
0.6.0
0.5.0
0.4.0
0.3.3
0.3.2
0.3.1
0.3.0
0.2.0
0.1.0
0.0.4
0.0.3
0.0.1