Retrofit+OKHttp API需要上传JSONArray格式的数据,APIService

1.Retrofit+OKHttp POST JSONArray怎么请求??

胡子哥哥
浏览 717回答 1
1回答

富国沪深

&nbsp;/* 添加评论 */&nbsp; &nbsp; @POST("api/Comment")&nbsp; &nbsp; @Headers({"Content-Type: application/json;charset=UTF-8"})&nbsp; &nbsp; Observable<ApiResponseBean> postComment(@Body RequestCommentBean commentBean);new Retrofit.Builder()&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .baseUrl(API_BASE_URL)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addConverterFactory(GsonConverterFactory.create())直接用gson,把实体自动转json然后上传吧。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java