0

is it possible to set the http request header with capybara? i have seen several posts like this

Capybara.current_session.driver.headers = { 'Accept-Language' => 'de' }
Capybara.current_session.driver.header('Accept-Language', 'de')

but doesn't seem to work. I am trying to set the following header

X-TEST-IP : 127.0.0.1

That when i visit my site, I am authenticated. Any ideas? Thanks

1 Answers1

0

You’re using selenium which doesn’t provide a way to set headers. It is possible through middleware or a programmable proxy - see setting request headers in selenium , although you’re probably better off just using the test mode of whatever auth library you are using (devise, etc)

Thomas Walpole
  • 48,548
  • 5
  • 64
  • 78