I use a custom http header for URL signature just called "sign", how to get such custom HTTP header value in Django?
Note in Django you write the header name in capitals with underscores instead of dashes, but in the request on the client you must write it using dashes instead of underscores (production web servers will strip out custom headers with underscores in them for security reasons).
HttpResponse (source code) provides an inbound HTTP request to a Django web application with a text response. This class is most frequently used as a return object from a Django view.
getKey() + " ,Value : " + entry. getValue()); } //get header by 'key' String server = conn. getHeaderField("Server");
Go ahead and use:
request.META.get('HTTP_{your uppercased header name}')
Note in Django you write the header name in capitals with underscores instead of dashes, but in the request on the client you must write it using dashes instead of underscores (production web servers will strip out custom headers with underscores in them for security reasons).
So, a custom header My-Custom-Header
is accessed request.META['HTTP_MY_CUSTOM_HEADER']
Finally I found just get it through
request.META('HTTP_{your uppercased header name}')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With