Skip to content

Commit d8a53a4

Browse files
Add user agent to http query
1 parent 6771101 commit d8a53a4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/maxgamer/quickshop/util/HttpUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import okhttp3.Response;
2929
import org.jetbrains.annotations.NotNull;
3030
import org.jetbrains.annotations.Nullable;
31+
import org.maxgamer.quickshop.QuickShop;
3132

3233
import java.io.File;
3334
import java.io.IOException;
@@ -91,7 +92,7 @@ public static String createGet(@NotNull String url, boolean flushCache) {
9192
return cache;
9293
}
9394
}
94-
try (Response response = client.newCall(new Request.Builder().get().url(url).build()).execute()) {
95+
try (Response response = client.newCall(new Request.Builder().get().url(url).header("User-Agent", "Java QuickShop-" + QuickShop.getFork() + " " + QuickShop.getVersion()).build()).execute()) {
9596
val body = response.body();
9697
if (body == null) {
9798
return null;

0 commit comments

Comments
 (0)