MCPcopy
hub / github.com/square/okhttp / post

Method post

samples/guide/src/main/java/okhttp3/guide/PostExample.java:30–39  ·  view source on GitHub ↗
(String url, String json)

Source from the content-addressed store, hash-verified

28 final OkHttpClient client = new OkHttpClient();
29
30 String post(String url, String json) throws IOException {
31 RequestBody body = RequestBody.create(json, JSON);
32 Request request = new Request.Builder()
33 .url(url)
34 .post(body)
35 .build();
36 try (Response response = client.newCall(request).execute()) {
37 return response.body().string();
38 }
39 }
40
41 String bowlingJson(String player1, String player2) {
42 return "{'winCondition':'HIGH_SCORE',"

Callers 9

mainMethod · 0.95
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80

Calls 1

createMethod · 0.80

Tested by

no test coverage detected