6

When using Geb, is it possible to set custom request headers and user agent when using the Browser API (and not the Direct Download API)?

While this is possible with the FirefoxDriver (see here), I am looking for a way of doing this with the WebKitDriver.

Charles
  • 50,943
  • 13
  • 104
  • 142
Behrang
  • 46,888
  • 25
  • 118
  • 160

1 Answers1

0

A possible solution is via a proxy.

  • BrowserMob has a standalone mode with REST api, or embedded in your test programmatically: https://github.com/webmetrics/browsermob-proxy . Useful when there are a lot of custom headers you want to test.
  • If you already have Apache, you can create another VirtualHost on a different port having that particular request header, and point your browser to that port before the test. Given that your header doesn't change between tests.

This might not be the direct solution to your question: modify request headers directly in Browser API, but it achieves the end result.

Linh
  • 535
  • 1
  • 6
  • 13