diff --git a/src/main/java/io/gitlab/jfronny/commons/HttpUtils.java b/src/main/java/io/gitlab/jfronny/commons/HttpUtils.java index 0f794fe..7f18ca4 100644 --- a/src/main/java/io/gitlab/jfronny/commons/HttpUtils.java +++ b/src/main/java/io/gitlab/jfronny/commons/HttpUtils.java @@ -2,9 +2,7 @@ package io.gitlab.jfronny.commons; import io.gitlab.jfronny.commons.serialize.Serializer; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; +import java.io.*; import java.lang.reflect.Type; import java.net.*; import java.net.http.HttpClient; @@ -160,6 +158,7 @@ public class HttpUtils { } return _send(accept, responseBodyHandler); } + if (res.statusCode() == 404) throw new FileNotFoundException("Didn't find anything under that url (URL=" + url + ")"); throw new IOException("Unexpected return method: " + res.statusCode() + " (URL=" + url + ")"); } @@ -216,4 +215,8 @@ public class HttpUtils { public static Request delete(String url) throws URISyntaxException { return new Request(Method.DELETE, url); } + + public static void main(String[] args) throws URISyntaxException, IOException { + get("https://frohnmeyer-wds.de/doesnt_exxist").send(); + } }