forked from zaclys/searxng
Merge pull request #303 from dalf/patch-1
Revert of #195 when the search language is not english
This commit is contained in:
commit
01de1c6f78
|
@ -76,6 +76,7 @@ def request(query, params):
|
|||
query=urlencode({'q': query}))
|
||||
|
||||
params['headers']['Accept-Language'] = language
|
||||
if language.startswith('en'):
|
||||
params['cookies']['PREF'] = get_google_pref_cookie()
|
||||
|
||||
return params
|
||||
|
|
|
@ -17,12 +17,13 @@ class TestGoogleEngine(SearxTestCase):
|
|||
self.assertIn('url', params)
|
||||
self.assertIn(query, params['url'])
|
||||
self.assertIn('google.com', params['url'])
|
||||
self.assertIn('PREF', params['cookies'])
|
||||
self.assertNotIn('PREF', params['cookies'])
|
||||
self.assertIn('fr', params['headers']['Accept-Language'])
|
||||
|
||||
dicto['language'] = 'all'
|
||||
params = google.request(query, dicto)
|
||||
self.assertIn('en', params['headers']['Accept-Language'])
|
||||
self.assertIn('PREF', params['cookies'])
|
||||
|
||||
def test_response(self):
|
||||
self.assertRaises(AttributeError, google.response, None)
|
||||
|
|
Loading…
Reference in New Issue