diff options
Diffstat (limited to 'spark-common/src')
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/common/util/BytebinClient.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/util/BytebinClient.java b/spark-common/src/main/java/me/lucko/spark/common/util/BytebinClient.java index 8f11edc..b8a2053 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/util/BytebinClient.java +++ b/spark-common/src/main/java/me/lucko/spark/common/util/BytebinClient.java @@ -47,7 +47,11 @@ public class BytebinClient { this.userAgent = userAgent; } - private Content postContent(String contentType, Consumer<OutputStream> consumer, String userAgent) throws IOException { + private Content postContent(String contentType, Consumer<OutputStream> consumer, String userAgentExtra) throws IOException { + String userAgent = userAgentExtra != null + ? this.userAgent + "/" + userAgentExtra + : this.userAgent; + URL url = new URL(this.url + "post"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); try { @@ -83,11 +87,11 @@ public class BytebinClient { } catch (IOException e) { throw new RuntimeException(e); } - }, this.userAgent + "/" + userAgentExtra); + }, userAgentExtra); } public Content postContent(AbstractMessageLite<?, ?> proto, String contentType) throws IOException { - return postContent(proto, contentType, this.userAgent); + return postContent(proto, contentType, null); } public static final class Content { |