/oh-my-request

🔮 simple request library by java8

Primary LanguageJavaApache License 2.0Apache-2.0

oh-my-request

HTTP request easier operation.

@biezhi on zhihu

Usage

Maven ArtifactId

<dependency>
    <groupId>io.github.biezhi</groupId>
    <artifactId>oh-my-request</artifactId>
    <version>0.0.1</version>
</dependency>

1. Get Request

String body = Request.get("https://github.com/opensearch.xml").body();
System.out.println(body);

2. Save To File

Request.get("https://avatars3.githubusercontent.com/u/3849072?v=3&s=460")
.receive(new File("D:/avatar.png"));

3. Post Request

Request.post("http://xxxx.com")
.form("name", "jack")
.body();

4. Headers

Request.get("http://xxxx.com")
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) xxxx")
.body();

License

Apache2