Getting custom HTTP request headers in web.py?
-
30-05-2021 - |
Pregunta
I know that, with web.ctx.env, I can get a lot of information that comes from the headers -- but only the standard headers. Is it possible to obtain all HTTP request headers from within a GET or POST method in web.py?
Solución
Are you sure that it has only standard headers? Cos I'm using it to check web.ctx.env.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
which is not in the list on that page. I also get values of HTTP_X_FILE_NAME
and HTTP_X_FILE_TYPE
headers that I set in xhr like this: xhr.setRequestHeader( "X-File-Type", file.type );
.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow