diff --git a/build.gradle b/build.gradle index d1bb8719..9618b5e9 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,8 @@ dependencies { implementation 'com.fasterxml.jackson.core:jackson-annotations:2.17.0' implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.0' + implementation 'com.github.mizosoft.methanol:methanol:1.7.0' + implementation 'io.vertx:vertx-web-client:4.5.7' implementation 'io.vertx:vertx-core:4.5.7' diff --git a/src/main/java/com/javadiscord/jdi/internal/api/DiscordRequestBuilder.java b/src/main/java/com/javadiscord/jdi/internal/api/DiscordRequestBuilder.java index c4d5387f..6834d167 100644 --- a/src/main/java/com/javadiscord/jdi/internal/api/DiscordRequestBuilder.java +++ b/src/main/java/com/javadiscord/jdi/internal/api/DiscordRequestBuilder.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.mizosoft.methanol.MultipartBodyPublisher; import java.net.URLEncoder; import java.net.http.HttpRequest; @@ -52,6 +53,17 @@ public DiscordRequestBuilder body(Map payload) { return this; } + public DiscordRequestBuilder body(HttpRequest.BodyPublisher body) { + this.body = body; + return this; + } + + public DiscordRequestBuilder multipartBody(MultipartBodyPublisher body) { + this.body = body; + this.headers.put("Content-Type", "multipart/form-data"); + return this; + } + public DiscordRequestBuilder get() { this.method = HttpMethod.GET; return this;