diff --git a/src/main/java/io/supertokens/httpRequest/HttpRequest.java b/src/main/java/io/supertokens/httpRequest/HttpRequest.java index b3f7e805d..2a93c0e97 100644 --- a/src/main/java/io/supertokens/httpRequest/HttpRequest.java +++ b/src/main/java/io/supertokens/httpRequest/HttpRequest.java @@ -16,11 +16,11 @@ package io.supertokens.httpRequest; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; +import io.supertokens.Main; + +import java.io.*; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; @@ -28,11 +28,6 @@ import java.nio.charset.StandardCharsets; import java.util.Map; -import com.google.gson.JsonElement; -import com.google.gson.JsonParser; - -import io.supertokens.Main; - public class HttpRequest { private static final int STATUS_CODE_ERROR_THRESHOLD = 400; @@ -67,7 +62,7 @@ private static boolean isJsonValid(String jsonInString) { @SuppressWarnings("unchecked") public static T sendGETRequest(Main main, String requestID, String url, Map params, - int connectionTimeoutMS, int readTimeoutMS, Integer version) + int connectionTimeoutMS, int readTimeoutMS, Integer version) throws IOException, HttpResponseException { StringBuilder paramBuilder = new StringBuilder(); @@ -129,9 +124,9 @@ public static T sendGETRequest(Main main, String requestID, String url, Map< @SuppressWarnings("unchecked") public static T sendGETRequestWithResponseHeaders(Main main, String requestID, String url, - Map params, - int connectionTimeoutMS, int readTimeoutMS, Integer version, - Map responseHeaders) + Map params, + int connectionTimeoutMS, int readTimeoutMS, Integer version, + Map responseHeaders) throws IOException, HttpResponseException { StringBuilder paramBuilder = new StringBuilder(); @@ -198,7 +193,7 @@ public static T sendGETRequestWithResponseHeaders(Main main, String requestI } private static T sendJsonRequest(Main main, String requestID, String url, JsonElement requestBody, - int connectionTimeoutMS, int readTimeoutMS, Integer version, String method) + int connectionTimeoutMS, int readTimeoutMS, Integer version, String method) throws IOException, HttpResponseException { URL obj = getURL(main, requestID, url); InputStream inputStream = null; @@ -262,16 +257,17 @@ public static T sendJsonPOSTRequest(Main main, String requestID, String url, } public static T sendJsonPUTRequest(Main main, String requestID, String url, JsonElement requestBody, - int connectionTimeoutMS, int readTimeoutMS, Integer version) + int connectionTimeoutMS, int readTimeoutMS, Integer version) throws IOException, HttpResponseException { return sendJsonRequest(main, requestID, url, requestBody, connectionTimeoutMS, readTimeoutMS, version, "PUT"); } public static T sendJsonDELETERequest(Main main, String requestID, String url, JsonElement requestBody, - int connectionTimeoutMS, int readTimeoutMS, Integer version) + int connectionTimeoutMS, int readTimeoutMS, Integer version) throws IOException, HttpResponseException { return sendJsonRequest(main, requestID, url, requestBody, connectionTimeoutMS, readTimeoutMS, version, "DELETE"); } -} \ No newline at end of file +} + \ No newline at end of file diff --git a/src/main/java/io/supertokens/httpRequest/HttpResponseException.java b/src/main/java/io/supertokens/httpRequest/HttpResponseException.java index 10686c518..4d2c5f7f1 100644 --- a/src/main/java/io/supertokens/httpRequest/HttpResponseException.java +++ b/src/main/java/io/supertokens/httpRequest/HttpResponseException.java @@ -21,11 +21,9 @@ public class HttpResponseException extends Exception { private static final long serialVersionUID = 1L; public final int statusCode; - public final String rawMessage; HttpResponseException(int statusCode, String message) { super("Http error. Status Code: " + statusCode + ". Message: " + message); this.statusCode = statusCode; - this.rawMessage = message; } -} +} \ No newline at end of file