Skip to content

Latest commit

 

History

History
52 lines (31 loc) · 1.68 KB

README.md

File metadata and controls

52 lines (31 loc) · 1.68 KB

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)