I need to find a way to disable the user agent header so that I can recreate an issue I'm seeing on a production server.
A few experiments have failed - the most obvious, after looking at the api, was:
wc.getClientProperties().getDefaultProperties().setUserAgent(null);
wc.getClientProperties().setUserAgent(null);
I still get a user agent header, with the value: httpunit/1.5
Any way to do this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can the user-agent header be disabled?
I need to find a way to disable the user agent header so that I can recreate an issue I'm seeing on a production server.
A few experiments have failed - the most obvious, after looking at the api, was:
wc.getClientProperties().getDefaultProperties().setUserAgent(null);
wc.getClientProperties().setUserAgent(null);
I still get a user agent header, with the value: httpunit/1.5
Any way to do this?
Hi
You can set userAgent as showed there:
WebRequest req = .....
req.setHeaderField("User-Agent", "new-user-agent");