Merge pull request #2528 from theonefx/develop

fix: https://github.com/alibaba/nacos/issues/2527
This commit is contained in:
Peter Zhu 2020-03-26 15:24:18 +08:00 committed by GitHub
commit 449ed0831a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,9 @@ import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URLEncoder;
import java.util.*;
import java.util.concurrent.*;
@ -327,7 +329,11 @@ public class NamingProxy {
Map<String, String> params = new HashMap<String, String>(8);
String body = StringUtils.EMPTY;
if (!lightBeatEnabled) {
body = "beat=" + JSON.toJSONString(beatInfo);
try {
body = "beat=" + URLEncoder.encode(JSON.toJSONString(beatInfo), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new NacosException(NacosException.SERVER_ERROR, "encode beatInfo error", e);
}
}
params.put(CommonParams.NAMESPACE_ID, namespaceId);
params.put(CommonParams.SERVICE_NAME, beatInfo.getServiceName());