use of com.benmu.framework.http.okhttp.exception.IrregularUrlException in project WeexErosFramework by bmfe.
the class AxiosManager method post.
public void post(String mUrl, String data, HashMap<String, String> header, StringCallback stringCallback, Object tag, long timeout) {
mUrl = safeUrl(mUrl);
if (mUrl == null) {
if (stringCallback != null) {
stringCallback.onError(null, new IrregularUrlException("url不合法"), 0);
}
return;
}
setTimeout(timeout);
String contentType = null;
if (header != null) {
contentType = header.get("Content-Type");
}
if (TextUtils.isEmpty(contentType)) {
contentType = DEFAULT_MEDIATYPE;
}
OkHttpUtils.postString().url(mUrl).content(data).mediaType(MediaType.parse(contentType)).headers(header).tag(tag).build().execute(stringCallback);
}
use of com.benmu.framework.http.okhttp.exception.IrregularUrlException in project WeexErosFramework by bmfe.
the class AxiosManager method put.
public void put(String url, String content, HashMap<String, String> header, StringCallback callBack, Object tag, long timeout) {
url = safeUrl(url);
if (url == null) {
if (callBack != null) {
callBack.onError(null, new IrregularUrlException("url不合法"), 0);
}
return;
}
if (header == null) {
header = new HashMap<>();
}
setTimeout(timeout);
OtherRequestBuilder builder = OkHttpUtils.put().url(url).tag(tag).headers(header);
if (content != null) {
builder.requestBody(createRequestBodyByMediaType(header, content));
}
builder.build().execute(callBack);
}
Aggregations