kohttp
  • Introduction
  • Core
    • Synchronous calls
      • GET
      • POST
      • PUT
      • HEAD
      • DELETE
      • PATCH
      • Generic requests
      • Upload files
    • Asynchronous calls
      • async GET
      • async POST
      • async PUT
      • async HEAD
      • async DELETE
      • async PATCH
      • async Generic requests
      • async Upload files
    • Response usage
    • Interceptors
    • Customisation
    • Experimental features
  • History
    • Changelog
Powered by GitBook
On this page
  • Features
  • Quick start
  • Samples
  • About kohttp
  • Installation
  • Gradle
  • Maven:
  • Table of contents

Was this helpful?

Introduction

NextSynchronous calls

Last updated 5 years ago

Was this helpful?

Kotlin DSL http client

Features

🔹 Developers Experience-driven library without verbosity.

🔹 Native way to use http client in Kotlin.

🔹 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

🔹 HTTP ///// requests.

🔹 and requests.

🔹 .

🔹 - easily dump your http requests or convert them to cURL commands.

mentioned us

mentioned us

- medium post

- medium post

- medium post

- Kotlin/Everywhere talk, YouTube

GET
POST
PUT
HEAD
DELETE
PATCH
Asynchronous
blocking
Upload files
Android application
Spring Boot application
Kotlin weekly
Android weekly (CN)
Kotlin http client. Making kohttp 0.11.0
Write your Android network as Kotlin DSL
Upload files to Google Drive with Kotlin
Production Kotlin DSL (RU + subtitles)
Synchronous calls
GET
POST
PUT
HEAD
DELETE
PATCH
Upload files
Generic requests
Asynchronous calls
async GET
async POST
async PUT
async HEAD
async DELETE
async PATCH
async Upload files
async Generic requests
Response usage
Interceptors
Customisation
Experimental features
Changelog
Build Status
Maven Central
codecov
Kotlin
Awesome Kotlin Badge
Join the chat at https://gitter.im/kohttp/community
star this repo
Logging
Codacy Badge