Fiddler设置代理 抓取HttpClient请求参数

 HttpHost proxy = new HttpHost("localhost",8888,"http");
            RequestConfig config = RequestConfig.custom().setProxy(proxy).setConnectTimeout(10000).setSocketTimeout(15000).build();
            CloseableHttpClient client= HttpClientBuilder.create().setDefaultRequestConfig(config).build();
            
            HttpPost httpPost = new HttpPost("http://localhost:9999/anti_fraud/es/ga-es/capitalFrozen/sendData");
            httpPost.setHeader("extra", "****");
            
            MultipartEntityBuilder EntityBuilder = MultipartEntityBuilder.create();
            ContentType contentType=ContentType.create("text/plain",Charset.forName("UTF-8"));
            EntityBuilder.setCharset(Consts.UTF_8);
            EntityBuilder.setContentType(ContentType.MULTIPART_FORM_DATA);
            EntityBuilder.addPart("jsonStr", new StringBody(data,contentType));
            httpPost.setEntity(EntityBuilder.build());
            
            HttpResponse response = client.execute(httpPost);

上一篇:企业微信机器人发送消息


下一篇:Httpclient 表单,json,multipart/form-data 提交 ---总结常用的方法