Skip to content

Commit

Permalink
Document the use of self.xsrf_token to set the cookie for ajax-only a…
Browse files Browse the repository at this point in the history
…pps.

Closes tornadoweb#645.
  • Loading branch information
bdarnell committed Dec 2, 2012
1 parent e25b753 commit eea63fc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion website/sphinx/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,11 @@ all requests:

For ``PUT`` and ``DELETE`` requests (as well as ``POST`` requests that
do not use form-encoded arguments), the XSRF token may also be passed
via an HTTP header named ``X-XSRFToken``.
via an HTTP header named ``X-XSRFToken``. The XSRF cookie is normally
set when ``xsrf_form_html`` is used, but in a pure-Javascript application
that does not use any regular forms you may need to access
``self.xsrf_token`` manually (just reading the property is enough to
set the cookie as a side effect).

If you need to customize XSRF behavior on a per-handler basis, you can
override ``RequestHandler.check_xsrf_cookie()``. For example, if you
Expand Down

0 comments on commit eea63fc

Please sign in to comment.