Custom HTTP Header in Django

后端 未结 6 1990
春和景丽
春和景丽 2020-12-30 19:23

I use a custom http header for URL signature just called \"sign\", how to get such custom HTTP header value in Django?

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-30 20:13

    I was trying to access the header with the above answers, using this code:

    request.META.get('HTTP_{your uppercased header name}')
    

    But It didn't work for me, and then I realized that the custom header should not contain underscore so I changed the underscore with dash and boom, everything started working. Hope this will help people like me. :-)

提交回复
热议问题