com.github.cosycode.ext.web.http.MyHttpRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of extend-mod Show documentation
Show all versions of extend-mod Show documentation
扩展模块, 用于存放一些非常用的工具或模块的扩展类, 例如在poi基础上扩展的excel的导入模块, 模拟按键模块
The newest version!
package com.github.cosycode.ext.web.http;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.apache.hc.core5.http.Method;
import java.util.Map;
/**
* Description :
*
* created in 2023/5/14
*
*
* @author CPF
**/
@Data
@Accessors(fluent = true)
@ToString
public class MyHttpRequest {
private String method;
private Map headers;
private String requestUrl;
private Map params;
private Object jsonBody;
public MyHttpRequest(String method, String requestUrl) {
this.method = method;
this.requestUrl = requestUrl;
}
public static MyHttpRequest buildGet(String url) {
return new MyHttpRequest(Method.GET.name(), url);
}
public static MyHttpRequest buildPut(String url) {
return new MyHttpRequest(Method.PUT.name(), url);
}
public static MyHttpRequest buildPost(String url) {
return new MyHttpRequest(Method.POST.name(), url);
}
public static MyHttpRequest buildDelete(String url) {
return new MyHttpRequest(Method.DELETE.name(), url);
}
public static MyHttpRequest buildPatch(String url) {
return new MyHttpRequest(Method.PATCH.name(), url);
}
}