feat: mock功能
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package org.nl.tool.api;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.tool.core.enums.HttpMethodEnum;
|
||||
|
||||
/**
|
||||
* mock-api提供者接口
|
||||
* @author: lyd
|
||||
* @date: 2026/1/28
|
||||
*/
|
||||
public interface MockApi {
|
||||
|
||||
/**
|
||||
* 通用的执行请求
|
||||
* @param url 路径(ip:端口号/api地址)
|
||||
* @param method 方法类型:GET、POST、PUT、DELETED
|
||||
* @param body 数据内容:JSONObject.toString
|
||||
* @see JSONObject#toJSONString()
|
||||
* @return
|
||||
*/
|
||||
String executeRequestCommon(String url, HttpMethodEnum method, String body);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.nl.tool.core.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: lyd
|
||||
* @date: 2026/1/29
|
||||
*/
|
||||
@Getter
|
||||
public enum HttpMethodEnum {
|
||||
GET("GET"),
|
||||
POST("POST"),
|
||||
PUT("PUT"),
|
||||
DELETE("DELETE");
|
||||
|
||||
private final String code;
|
||||
|
||||
HttpMethodEnum(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user