How to make OKHTTP post request without a request body?

前端 未结 3 1093
你的背包
你的背包 2021-02-06 22:24

Possible way to make OkHTTP post request without a request body in okhttp library ?

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-06 22:46

        RequestBody reqbody = RequestBody.create(null, new byte[0]);  
        Request.Builder formBody = new Request.Builder().url(url).method("POST",reqbody).header("Content-Length", "0");
        clientOk.newCall(formBody.build()).enqueue(OkHttpCallBack());
    

提交回复
热议问题