All Downloads are FREE. Search and download functionalities are using the official Maven repository.

wei-k.httpz-native_2.10.0.5.1.source-code.HttpzNative.scala Maven / Gradle / Ivy

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