mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2025-03-07 13:48:00 +08:00
Fixed review notes
This commit is contained in:
parent
49023a352c
commit
254fe1296a
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.util.net;
|
||||
|
||||
import com.sk89q.worldedit.util.concurrency.LazyReference;
|
||||
import com.sk89q.worldedit.util.io.Closer;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
@ -39,6 +38,7 @@
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@ -90,7 +90,7 @@ public HttpRequest body(String data) {
|
||||
*/
|
||||
public HttpRequest bodyUrlEncodedForm(Form form) {
|
||||
contentType = "application/x-www-form-urlencoded";
|
||||
body = form.toUrlEncodedString().getBytes();
|
||||
body = form.toUrlEncodedString().getBytes(StandardCharsets.UTF_8);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ public HttpRequest bodyUrlEncodedForm(Form form) {
|
||||
*/
|
||||
public HttpRequest bodyMultipartForm(Form form) {
|
||||
contentType = "multipart/form-data;boundary=" + form.getFormDataSeparator();
|
||||
body = form.toFormDataString().getBytes();
|
||||
body = form.toFormDataString().getBytes(StandardCharsets.UTF_8);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -387,11 +387,10 @@ private static URL reformat(URL existing) {
|
||||
public static final class Form {
|
||||
public final Map<String, String> elements = new LinkedHashMap<>();
|
||||
|
||||
private LazyReference<String> formDataSeparator = LazyReference.from(
|
||||
() -> "-----EngineHubFormData" + ThreadLocalRandom.current().nextInt(10000, 99999)
|
||||
);
|
||||
private final String formDataSeparator;
|
||||
|
||||
private Form() {
|
||||
this.formDataSeparator = "-----EngineHubFormData" + ThreadLocalRandom.current().nextInt(10000, 99999);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -407,11 +406,11 @@ public Form add(String key, String value) {
|
||||
}
|
||||
|
||||
public String getFormDataSeparator() {
|
||||
return formDataSeparator.getValue();
|
||||
return formDataSeparator;
|
||||
}
|
||||
|
||||
public String toFormDataString() {
|
||||
String formSeparator = "--" + formDataSeparator.getValue();
|
||||
String formSeparator = "--" + formDataSeparator;
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
for (Map.Entry<String, String> element : elements.entrySet()) {
|
||||
|
@ -71,7 +71,6 @@ public URL call() throws IOException, InterruptedException {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
|
||||
private static final class SignedPasteResponse {
|
||||
String viewUrl;
|
||||
String uploadUrl;
|
||||
|
Loading…
Reference in New Issue
Block a user