fix: sponsor mess code

This commit is contained in:
huanghongxun
2021-08-24 03:44:12 +08:00
parent 837c7adaa7
commit f5a16ae005
2 changed files with 3 additions and 3 deletions

View File

@@ -110,8 +110,7 @@ public class SponsorPage extends StackPane {
private void loadSponsorList() {
Task.<List<Sponsor>>supplyAsync(() -> HttpRequest.GET("https://hmcl.huangyuhui.net/api/sponsor").getJson(new TypeToken<List<Sponsor>>() {
}.getType())
).thenAcceptAsync(Schedulers.javafx(), sponsors -> {
}.getType())).thenAcceptAsync(Schedulers.javafx(), sponsors -> {
listView.getItems().setAll(sponsors);
}).start();
}

View File

@@ -28,6 +28,7 @@ import java.lang.reflect.Type;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
@@ -97,7 +98,7 @@ public abstract class HttpRequest {
public String getString() throws IOException {
HttpURLConnection con = createConnection();
con = resolveConnection(con);
return IOUtils.readFullyAsString(con.getInputStream());
return IOUtils.readFullyAsString(con.getInputStream(), StandardCharsets.UTF_8);
}
}