1. Mikhail Korobov
  2. django-webtest
  3. Issues
Issue #13 wontfix

HTTP_REFERER not send

Vadim Lopatyuk
created an issue

I need test redirecting to previous page, but django always return {{{None}}} in

{{{

!python

request.META.get('HTTP_REFERER') }}}

when i try something like

{{{

!python

page.click('some link').follow() }}}

If i run {{{manage.py runserver}}} all works fine. How to test redirect back?

Comments (2)

  1. Mikhail Korobov repo owner

    Yes, there is no automatic HTTP_REFERER handling in django_webtest and Webtest. Standard django's test client doesn't send HTTP_REFERER header either.

    You can use 'extra_environ' kwarg of 'click' and 'follow' functions to set desired HTTP_REFERER value.

    If you want automatic HTTP_REFERER handling please submit an issue to Webtest ( https://bitbucket.org/ianb/webtest/ ).

    In my opinion it is not good to absolutely rely on HTTP_REFERER because this header is optional. So if the test fails because of absent HTTP_REFERER it means your code won't work for some users so the test is correct and shows a potential bug.

    I'm closing ticket as wontfix because this is the desired behavior and anyway this issue belongs to Webtest, not to django-webtest. Thanks!

  2. Log in to comment