Provide URL encoded placeholders in notification template for 3PID data
This commit is contained in:
@@ -25,12 +25,22 @@ import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class RestClientUtils {
|
||||
|
||||
private static Gson gson = GsonUtil.build();
|
||||
|
||||
public static String urlEncode(String value) {
|
||||
try {
|
||||
return URLEncoder.encode(value, StandardCharsets.UTF_8.name());
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static HttpPost post(String url, String body) {
|
||||
StringEntity entity = new StringEntity(body, StandardCharsets.UTF_8);
|
||||
entity.setContentType(ContentType.APPLICATION_JSON.toString());
|
||||
|
||||
Reference in New Issue
Block a user