目前的措施是先将JS的Boolean类型转化成字符串类型
wx.uploadFile的表单数据含Boolean值时会变成[[object Boolean]]?微信开发者工具Stable 1.06.2405010 调试基础库3.4.5 JS代码: let tmp = res.tempFiles[0].tempFilePath; wx.uploadFile({ url: `${BASE_URL}/test`, name: 'file', filePath: tmp, formData: { // 表单Boolean param: true }, success: res => { console.log(res); }, fail: err => { console.log(err); } }); 后端代码: @RestController @RequestMapping("/test") public class TestController { @PostMapping public ApiResponse testUpload(@RequestParam MultipartFile file, @RequestParam Boolean param) { return ApiResponse.success(); } } 报错: [图片] { msg: "[2024-06-12 23:02:05.784]: (MethodArgumentTypeMismatchException) Failed to convert value of type 'java.lang.String' to required type 'java.lang.Boolean'; Invalid boolean value [[object Boolean]]" }
2024-06-13