由于不得不用get请求来远程传参,而参数里包含json数组 导致报错;格式如下:
fileJson=[{“fullFileName”:“test_1.mov”,“fileName”:“test_1”,“suffix”:“mov”,“filesize”:37112932,“path”:“videos/test_1.mov”,“lastModified”:1586516785900,“creationTime”:1586516786170,“efficacy”:“d10910fed3c70ef778a5604acd28412b790657d2”}]
解决办法:采用占位符的办法
要传的参数:
String fileJson=fileJson.toString();
String callback=“callback”;
String katalonExecute=“xxx”;
url写法:
String url=“http://localhost:8080/TEST/katalon/command.do?action={callback}&katalonExecute={katalonExecute}&fileJson={fileJson}”;
调用:
String response= restTemplate.getForObject(url, String.class, callback,katalonExecute,fileJson);