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

Method run

samples/guide/src/main/java/okhttp3/recipes/PostFile.java:32–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30 private final OkHttpClient client = new OkHttpClient();
31
32 public void run() throws Exception {
33 File file = new File("README.md");
34
35 Request request = new Request.Builder()
36 .url("https://api.github.com/markdown/raw")
37 .post(RequestBody.create(file, MEDIA_TYPE_MARKDOWN))
38 .build();
39
40 try (Response response = client.newCall(request).execute()) {
41 if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
42
43 System.out.println(response.body().string());
44 }
45 }
46
47 public static void main(String... args) throws Exception {
48 new PostFile().run();

Callers 1

mainMethod · 0.45

Calls 2

postMethod · 0.80
createMethod · 0.80

Tested by

no test coverage detected