比如这样的接口
http://www.xxx.com/xxx/xxx
post方式传
token="xxx"
param="{user:{id:xxx,name:xxx},order:{id:xxx}}"
用retrofit 该怎么传?
我现在的方法
表单形式上传
@Field("token") string token
@Field("param") string param
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
将需要请求的数据定义成一个实体类
Retrofit 的 Service 这样子写就可以了,使用
@Body注解使用
HttpLoggingInterceptor可以在 log 中查看 HTTP 请求的详细情况。