其他分享
首页 > 其他分享> > Fiddler设置代理 抓取HttpClient请求参数

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);

标签:Fiddler,ContentType,create,抓取,EntityBuilder,build,httpPost,new,HttpClient
来源: https://blog.csdn.net/github_39083395/article/details/120179323