itgoyo / AndroidSummary

12 stars 4 forks source link

Retrofit POST json数据请求 #60

Open itgoyo opened 6 years ago

itgoyo commented 6 years ago

@Headers({"Content-type:application/json;charset=UTF-8"}) @POST("/user/userLogin")


                    MediaType mediaType = MediaType.parse("application/json");
                    //使用JSONObject封装参数

                    //创建RequestBody对象,将参数按照指定的MediaType封装
                    RequestBody requestBody = RequestBody.create(mediaType, jsonObject1.toString());

                    presenter.getData(requestBody);