browsermob-proxy
browsermob-proxy copied to clipboard
Browsermob-proxy does not add custom request header
Using browsermob proxy 2.1.5 with Selenium (3.14.0) Java code I'm trying to add a custom header to Chrome browser but the request header is not getting added to all requests
Sample code:
BrowserMobProxy proxy = new BrowserMobProxyServer();
proxy.addHeader("testGroup1" , "*****");
proxy.start(0);
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
String proxyOption = "--proxy-server=" + seleniumProxy.getHttpProxy();
chromeOptions.addArguments(proxyOption);
Also tried like the following,
proxy.addRequestFilter((request, contents, messageInfo) -> {
request.headers().add("testGroup1" , "*****");
return null;
});
String proxyOption = "--proxy-server=" + seleniumProxy.getHttpProxy();
chromeOptions.addArguments(proxyOption);
same here, the request are captured, but not altered, so I can log the request.getUri() but the headers().add() doesn't do anything to the actual request... ¯_(ツ)_/¯