zeab / j2s-java-net-http-client   2.0.0

Apache License 2.0 GitHub

Scala wrapper around Java.net Http Client with automatic case class support for json and xml

Scala versions: 2.12

j2s-java-net-http-client

Scala wrapper around Java.net Http Client with automatic case class support for json and xml (Circe and Aenea)

Maven Central Build Status Codacy Badge

Sync Example:

import io.circe.generic.auto._
import zeab.j2sjavanethttpclient.httpclient.HttpClient
HttpClient.invokeHttp[String, String](http://google.com)

Async Example:

import io.circe.generic.auto._
import zeab.j2sjavanethttpclient.httpclient.HttpClient
HttpClient.invokeAsyncHttp[String, String](http://google.com)

Request and Response Bodys:

import io.circe.generic.auto._
import zeab.j2sjavanethttpclient.httpclient.HttpClient

case class MyRequest(id:String)
case class MyResponse(id:String)

HttpClient.invokeHttp[MyRequest, MyResponse](http://google.com, "POST", MyRequest("1"), Map("Content-Type" -> "application/json", "Accept" -> "application/json"))

Performance Mode (skips dealing with the response body completely):

import io.circe.generic.auto._
import zeab.j2sjavanethttpclient.httpclient.HttpClient
HttpClient.invokeHttp[String, NoBody](http://google.com)