An open API service indexing awesome lists of open source software.

https://github.com/codemonstur/httpclient


https://github.com/codemonstur/httpclient

Last synced: 21 days ago
JSON representation

Awesome Lists containing this project

README

          

[![GitHub Release](https://img.shields.io/github/release/codemonstur/httpclient.svg)](https://github.com/codemonstur/httpclient/releases)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.codemonstur/httpclient/badge.svg)](http://mvnrepository.com/artifact/com.github.codemonstur/httpclient)
[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)

# HttpClient

A wrapper around the Java 11 HttpClient that makes for nicer code.

With some tweaking you can get this:

static class RecaptchaResponse { boolean success; String challenge_ts; String hostname; }

public static void main(final String... args) throws IOException {
final var response = newHttpCall()
.scheme("https").hostname("www.google.com").port(443)
.post("/recaptcha/api/siteverify")
.body(newFormBody()
.add("secret", "1234567890")
.add("response", "response"))
.execute()
.verifyNotServerError()
.verifySuccess()
.fetchBodyInto(RecaptchaResponse.class);
}

It's in Maven Central


com.github.codemonstur
httpclient
1.2.2