在通过 HTTP Client 发生 POST 请求时传递换行的参数报错的解决办法

在通过 HTTP Client 发生 POST 请求时传递换行的参数报错的解决办法

将参数进行 URL 编码后再传递。

String desc = null;
try {
  desc = URLEncoder.encode(param, "UTF-8");
} catch (UnsupportedEncodingException e) {
  throw new RuntimeException(e);
}

 

posted @ 2025-02-17 16:27  hapday  阅读(46)  评论(0)    收藏  举报