okhttp3.FormBody instead of FormEncodingBuilder.(OkHttp3.x,FormEncodingBuilder已被FormBody取代)
OkHttpClient client = new OkHttpClient();
FormBody body = new FormBody.Builder()
.add("your_param_1", "your_value_1")
.add("your_param_2", "your_value_2")
.build();
Request request = new Request.Builder()
.url("http://my.wonderfull.url/to/post")
.post(body)
.build();
Response response = client.newCall(request).execute();
https://github.com/square/okhttp,OkHttp3.x与2.x不同之处见CHANGELOG.md
————————————————
版权声明:本文为CSDN博主「xw1_xw」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/xw1_xw/article/details/50724864