diff --git a/.gitignore b/.gitignore index a1c2a23..094745b 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* + +.idea diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..1b27694 --- /dev/null +++ b/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + groupId + DZ_Java_Core + 1.0-SNAPSHOT + + + 16 + 16 + + + + + + com.squareup.okhttp3 + okhttp + 4.9.1 + + + + + + \ No newline at end of file diff --git a/src/main/java/Main.java b/src/main/java/Main.java new file mode 100644 index 0000000..b0b6642 --- /dev/null +++ b/src/main/java/Main.java @@ -0,0 +1,20 @@ +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import java.io.IOException; + +public class Main { + public static void main(String[] args) throws IOException { + OkHttpClient okHttpClient = new OkHttpClient(); + + Request request = new Request.Builder() + .url("https://icanhazdadjoke.com/") + .header("Accept", "application/json") + .build(); + + Response response = okHttpClient.newCall(request).execute(); + + System.out.println(response.body().string()); + } +}