https://github.com/codemonstur/httpclient
https://github.com/codemonstur/httpclient
Last synced: 21 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/codemonstur/httpclient
- Owner: codemonstur
- License: mit
- Created: 2022-10-31T16:43:20.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-10-16T11:51:14.000Z (over 2 years ago)
- Last Synced: 2023-10-29T02:44:38.281Z (over 2 years ago)
- Language: Java
- Size: 37.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/codemonstur/httpclient/releases)
[](http://mvnrepository.com/artifact/com.github.codemonstur/httpclient)
[](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