发表于 2024年03月25日 阅读1040次 1条评论
什么是Okhttp
常见的网络请求
- get请求
- 普通的post form请求
Content-Type:application/x-www-form-urlencoded
- 支持问价上传的post form请求
Content-Type:multipart/form-data;boundary=
- post jsoon字符串请求
常用用于APP与server
- 请求中携带自定义header信息
OkHttp的使用流程
- 创建请求:Request.Builder() Request对象
- 通过Request得到Call对象:client.newCall(Request) Call对象
- 执行Call
- 同步 call.execute(
- 异步 call.enqueue()
- 得到Response对象
封装参考
下面是一个封装好的okhttp 类
最后更新时间:2024年04月08日
猜你会喜欢
很好的文章