public class HttpClientTools extends Object
| Constructor and Description |
|---|
HttpClientTools() |
| Modifier and Type | Method and Description |
|---|---|
static String |
get(String url)
发起get请求
|
static String |
get(String url,
Map<String,String> headers)
发起get请求
|
static String |
post(String url,
Map<String,Object> paramMap)
发起post-form请求
|
static String |
post(String url,
Map<String,Object> paramMap,
Map<String,String> headers)
发起post-form请求
|
static String |
postJson(String url,
String requestBody)
发起post-json请求
|
static String |
postJson(String url,
String requestBody,
Map<String,String> headers)
发起post-json请求
|
static HttpClientResponse |
request(HttpClientRequest request)
发送请求
|
public static String get(String url, Map<String,String> headers)
url - 请求地址headers - 请求头public static String post(String url, Map<String,Object> paramMap)
url - 请求地址paramMap - 参数public static String post(String url, Map<String,Object> paramMap, Map<String,String> headers)
url - 请求地址paramMap - 参数headers - 请求头public static String postJson(String url, String requestBody)
url - 请求地址requestBody - 请求体public static String postJson(String url, String requestBody, Map<String,String> headers)
url - 请求地址requestBody - 请求体headers - 请求头public static HttpClientResponse request(HttpClientRequest request)
request - 入参Copyright © 2021. All rights reserved.