public void doDelete(){
OkHttpClient mOkHttpClient = new OkHttpClient().newBuilder()
.sslSocketFactory(OKHttpSafeUtils.getUnSafeSocketFactory(), OKHttpSafeUtils.UnSafeTrustManager)
.hostnameVerifier(OKHttpSafeUtils.UnSafeHostnameVerifier)
.build();
FormBody formBody = new FormBody.Builder().build();
Request.Builder builder = new Request.Builder().url(getRequestUrl()).delete(formBody);
builder.addHeader("bshtoken", getToken());
Request request = builder.build();
Call call = mOkHttpClient.newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
Log.e(TAG, "失败onFailure: " +e.getMessage());
}
@Override
public void onResponse(Call call, Response response) throws IOException {
ResponseBody body = response.body();
String s = body.toString();
Log.e(TAG, "成功onResponse: "+s );
}
});
}
网友评论