String url = "http://www.xxx.com/api/test";


OkHttpClient httpClient = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json;charset=UTF-8");

String post = "{\"test\":123}";


RequestBody requestBody = RequestBody.create(mediaType, post);


Request request = new Request.Builder()
.post(requestBody)
.url(url)
.build();

Response response = httpClient.newCall(request).execute();

转载于:https://www.cnblogs.com/SEC-fsq/p/9509866.html

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐