com.eworkcloud.okhttp.model.OkHttpMessage Maven / Gradle / Ivy
package com.eworkcloud.okhttp.model;
import com.eworkcloud.okhttp.enums.ContentType;
import com.eworkcloud.okhttp.enums.HttpMethod;
import lombok.Getter;
import lombok.Setter;
import java.util.LinkedHashMap;
import java.util.Map;
@Getter
@Setter
public class OkHttpMessage {
/**
* 请求路径
*/
private String url;
/**
* 请求方式
*/
private HttpMethod method = HttpMethod.GET;
/**
* 内容类型(POST、PUT有效)
*/
private ContentType contentType = ContentType.JSON;
/**
* Query参数
*/
private Map queryMap = new LinkedHashMap<>();
/**
* Header参数
*/
private Map headerMap = new LinkedHashMap<>();
/**
* Body参数(FORM|JSON 字符串)
*/
private String bodyString = "";
/**
* 添加Query参数
*
* @param key 键
* @param value 值
*/
public void addQuery(String key, String value) {
queryMap.put(key, value);
}
/**
* 添加Header参数
*
* @param key 键
* @param value 值
*/
public void addHeader(String key, String value) {
headerMap.put(key, value);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy