Replaced deprecated URLEncodedUtils

This commit is contained in:
Oleg Kalnichevski 2020-09-16 17:17:44 +02:00
parent ee26e23b31
commit 0524eed4b9
2 changed files with 4 additions and 4 deletions

View File

@ -60,7 +60,7 @@ import org.apache.hc.core5.http.NameValuePair;
import org.apache.hc.core5.http.io.entity.ByteArrayEntity;
import org.apache.hc.core5.http.io.entity.FileEntity;
import org.apache.hc.core5.http.io.entity.InputStreamEntity;
import org.apache.hc.core5.net.URLEncodedUtils;
import org.apache.hc.core5.net.WWWFormCodec;
import org.apache.hc.core5.util.Timeout;
/**
@ -334,7 +334,7 @@ public class Request {
}
final ContentType contentType = charset != null ?
ContentType.APPLICATION_FORM_URLENCODED.withCharset(charset) : ContentType.APPLICATION_FORM_URLENCODED;
final String s = URLEncodedUtils.format(paramList, contentType.getCharset());
final String s = WWWFormCodec.format(paramList, contentType.getCharset());
return bodyString(s, contentType);
}

View File

@ -32,7 +32,7 @@ import java.util.List;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.NameValuePair;
import org.apache.hc.core5.http.io.entity.StringEntity;
import org.apache.hc.core5.net.URLEncodedUtils;
import org.apache.hc.core5.net.WWWFormCodec;
/**
* An entity composed of a list of url-encoded pairs.
@ -54,7 +54,7 @@ public class UrlEncodedFormEntity extends StringEntity {
public UrlEncodedFormEntity(
final Iterable<? extends NameValuePair> parameters,
final Charset charset) {
super(URLEncodedUtils.format(
super(WWWFormCodec.format(
parameters,
charset != null ? charset : ContentType.APPLICATION_FORM_URLENCODED.getCharset()),
charset != null ? ContentType.APPLICATION_FORM_URLENCODED.withCharset(charset) : ContentType.APPLICATION_FORM_URLENCODED);