diff --git a/website/index.html b/website/index.html index bc1f4c3bc..71df17c79 100644 --- a/website/index.html +++ b/website/index.html @@ -76,35 +76,35 @@

Get a URL

This program downloads a URL and print its contents as a string. Full source.

-    OkHttpClient client = new OkHttpClient();
+OkHttpClient client = new OkHttpClient();
 
-    String run(String url) throws IOException {
-      Request request = new Request.Builder()
-          .url(url)
-          .build();
+String run(String url) throws IOException {
+  Request request = new Request.Builder()
+      .url(url)
+      .build();
 
-      Response response = client.newCall(request).execute();
-      return response.body().string();
-    }
+  Response response = client.newCall(request).execute();
+  return response.body().string();
+}
 

Post to a Server

This program posts data to a service. Full source.

-  public static final MediaType JSON
-      = MediaType.parse("application/json; charset=utf-8");
+public static final MediaType JSON
+    = MediaType.parse("application/json; charset=utf-8");
 
-  OkHttpClient client = new OkHttpClient();
+OkHttpClient client = new OkHttpClient();
 
-  String post(String url, String json) throws IOException {
-    RequestBody body = RequestBody.create(JSON, json);
-    Request request = new Request.Builder()
-        .url(url)
-        .post(body)
-        .build();
-    Response response = client.newCall(request).execute();
-    return response.body().string();
-  }
+String post(String url, String json) throws IOException {
+  RequestBody body = RequestBody.create(JSON, json);
+  Request request = new Request.Builder()
+      .url(url)
+      .post(body)
+      .build();
+  Response response = client.newCall(request).execute();
+  return response.body().string();
+}
 

Download