Skip to content

LangYa466/HttpClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HttpClient

简单轻量的网页请求库 像 Python 的 requests 一样写 HTTP 请求 支持 GET/POST 自动带参数 带 Cookie 还内置了常见的浏览器 UA(火狐/谷歌/Edge)

使用 maven/gradle 导入

快速开始

Response(toString默认为getBody)

GET

Response response = new HttpClient()
        .url("https://httpbin.org/get")
        .method(HttpMethod.GET)
        .header("User-Agent", UserAgent.FIREFOX)
        .param("name", "LangYa466")
        .cookie("session", "123456")
        .send();

        System.out.println("GET:" + response);

POST

        Response response = new HttpClient()
                .url("https://httpbin.org/post")
                .method(HttpMethod.POST)
                .header("User-Agent", UserAgent.CHROME)
                .param("name", "LangYa466")
                .cookie("token", "abcdef")
                .send();

        System.out.println("POST:" + response);

About

超轻量请求库,麻雀虽小,五脏俱全

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages