rybalkinsd / kohttp

Kotlin DSL http client
https://kohttp.gitbook.io
Apache License 2.0
480 stars 42 forks source link

[kohttp] Introduce `Request` dsl builder #147

Open doyaaaaaken opened 5 years ago

doyaaaaaken commented 5 years ago

Now we use Request.Builder() to create okhttp3.Request instance. https://github.com/rybalkinsd/kohttp/blob/c88850f5a6c8997a85747d759a5e9dc7c77c6cd2/src/test/kotlin/io/github/rybalkinsd/kohttp/interceptors/logging/CurlLoggingStrategyTest.kt#L35

It's better to introduce Request dsl builder and write code simpler like this.

request {
            url = "https://postman-echo.com/post"
            post = requestBody {
                contentType = "application/x-www-form-urlencoded"
                body = ""
            }
}

Discussed at here. https://github.com/rybalkinsd/kohttp/pull/141#discussion_r310082187

rybalkinsd commented 5 years ago

Hi @doyaaaaaken thanks for posting this issue.

depends on #128 #130 130