修改备注
This commit is contained in:
@@ -12,6 +12,10 @@ public class RequestContext {
|
||||
public final String host;
|
||||
public final Request.Builder builder;
|
||||
|
||||
/**
|
||||
* 使用 OkHttp Request.Builder 来初始化上下文,包括 scheme、host 和 headers
|
||||
* @param builder
|
||||
*/
|
||||
public RequestContext(Request.Builder builder) {
|
||||
this.builder = builder;
|
||||
List<String> nvList = builder.getHeaders$okhttp().getNamesAndValues$okhttp();
|
||||
@@ -27,6 +31,12 @@ public class RequestContext {
|
||||
this.host = url.replaceFirst("https?://", "").split("/")[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用指定 headers、scheme 和 host 来初始化上下文,一般用在单元测试场景
|
||||
* @param headers
|
||||
* @param scheme
|
||||
* @param host
|
||||
*/
|
||||
public RequestContext(Map<String, String> headers, String scheme, String host) {
|
||||
this.builder = null;
|
||||
this.headers = headers;
|
||||
|
||||
Reference in New Issue
Block a user