How to use curl with Django, csrf tokens and POST requests

前端 未结 6 2035
一个人的身影
一个人的身影 2020-12-07 13:10

I\'m using curl to test one of my Django forms. The calls I\'ve tried (with errors from each, and over multiple lines for readability):

(1):

curl
-d          


        
6条回答
  •  失恋的感觉
    2020-12-07 14:11

    X-CSRFToken in headers just need be the same with csrftoken in cookie.

    Example:

    curl -v http://www.markjour.com/login/ -H "X-CSRFToken: 123" -b "csrftoken=123" -d "username=admin&password=admin"
    

提交回复
热议问题