feat: sponsor list

This commit is contained in:
huanghongxun
2021-08-23 00:30:07 +08:00
parent 7bf06684c4
commit c18b0510bc
3 changed files with 102 additions and 14 deletions

View File

@@ -24,6 +24,7 @@ import org.jackhuang.hmcl.util.gson.JsonUtils;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Type;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
@@ -70,6 +71,10 @@ public abstract class HttpRequest {
return JsonUtils.fromNonNullJson(getString(), typeOfT);
}
public <T> T getJson(Type type) throws IOException, JsonParseException {
return JsonUtils.fromNonNullJson(getString(), type);
}
public HttpRequest filter(ExceptionalBiConsumer<URL, Integer, IOException> responseCodeTester) {
this.responseCodeTester = responseCodeTester;
return this;