在Java后台 发送http get请求,参数以form-data方式传递,要怎么实现呢?

 

使用HttpClient, 

CloseableHttpResponse response = httpClient.execute(httpPost);

封装请求:

httpPost.setEntity(请求实体) // MultipartEntityBuilder.build()可以得到

顺便说一下,文件这样设置

没有真正的文件的话,可以伪造一个

设置一下请求头就行了

找到你使用的发送Http请求的工具类,肯定有设置Header的地方,设置一下Content-type的类型