Setting a custom header using BrowserMob-Proxy REST api

匿名 (未验证) 提交于 2019-12-03 01:58:03

问题:

I have a browsermob proxy running on port 9091. I am trying to use browsermob-proxy REST API to set a custom header. When I make a request to my app using Selenium via the proxy, I don't see the header printed in my apps console. Below is my code. The request body is based on documentation here. My requirement is to use BrowserMob proxy API and not its Java library for this particular use case. Anything I am doing wrong in the code below?

 Proxy proxy = new java.net.Proxy(java.net.Proxy.Type.HTTP, new InetSocketAddress("localhost", 9091));   String bpmUrl = "http://localhost:8787/proxy/9091/interceptor/request";  Client client = Client.create();  String requestBody = "request.getMethod().addHeader(\"custom-header\", \"Bananabot/1.0\");";  WebResource resource = client.resource(bpmUrl);  resource.type(MediaType.TEXT_PLAIN_TYPE).post(requestBody);   String url = "http://localhost:8004";          
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!