wei-k.httpz-native_2.10.0.5.1.source-code.HttpzNative.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of httpz-native_2.10 Show documentation
Show all versions of httpz-native_2.10 Show documentation
purely functional http client
The newest version!
package httpz
package native
object HttpzNative{
def apply(req: httpz.Request): Http.Request = {
val r0 = req.method match {
case "GET" =>
Http.get(req.url)
case "POST" => req.body match {
case None => Http.post(req.url)
case Some(bytes) => Http.postData(req.url, bytes)
}
case other =>
Http(req.url).method(other)
}
val r1 = r0.params(req.params).headers(req.headers)
req.basicAuth.fold(r1){case (user, pass) => r1.auth(user, pass)}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy