use of com.dtflys.forest.http.body.SupportFormUrlEncoded in project forest by dromara.
the class DefaultFormConvertor method encodeRequestBody.
@Override
public byte[] encodeRequestBody(ForestBody body, Charset charset) {
List<RequestNameValue> nameValueList = new LinkedList<>();
if (charset == null) {
charset = StandardCharsets.UTF_8;
}
for (ForestRequestBody bodyItem : body) {
if (bodyItem instanceof SupportFormUrlEncoded) {
nameValueList.addAll(((SupportFormUrlEncoded) bodyItem).getNameValueList(configuration));
}
}
nameValueList = processFromNameValueList(nameValueList, configuration);
String strBody = formUrlEncodedString(nameValueList, charset);
byte[] bytes = strBody.getBytes(charset);
return bytes;
}
Aggregations