I could not find any matching method in sfTestFunctional
or sfBrowser
to set the UserAgent string. Maybe it's not possible because it goes through php-cli?
Asked
Active
Viewed 3,252 times
2

Alexander L. Hayes
- 3,892
- 4
- 13
- 34

Johannes Stedler
- 88
- 1
- 7
1 Answers
5
$browser->setHttpHeader('User-Agent', 'some custom string')->get('your url')
This sets the user agent for the next request, so maybe you want to extend the sfBrowser object to provide the HTTP headers on every request

Maxim Krizhanovsky
- 26,265
- 5
- 59
- 89
-
Any idea how to do this outside of Symfony? I'm using Laravel and would also like to manually set the User Agent for tests. – timetofly Apr 01 '14 at 22:31
-
2I have never used Lavarel, but a quick google reveals `$this->call('GET', '/api', array(), array(), array("HTTP_USER-AGENT"=>"some string"));`. [source](https://github.com/laravel/framework/issues/1655) – Maxim Krizhanovsky Apr 02 '14 at 06:04
-
Awesome, thank you! I wonder, what did you search for to find it? I searched a number of times and couldn't find the answer. Thanks. – timetofly Apr 02 '14 at 14:36
-
1@user371699 - "lavarel test set http header" – Maxim Krizhanovsky Apr 03 '14 at 07:24