java远程调用第三方同时带参数和文件的接口

img


如果我想在java程序中用hutool远程调用这样一个接口,代码如下:


 HttpResponse response = HttpRequest.post(url)
                .form("a",JSON.toJSONString(a))
                .form("multipartFiles", multipartFiles)
                .execute();

这样写的话报错

the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded;charset=UTF-8

求解决办法

content type把application/json取消掉