commit bd003b52a5076905ceadf514c4d360fee545bfc5
Author: Chris Dent <email address hidden>
Date: Fri Aug 18 16:42:20 2017 +0100
Provide a helper method to get headers from environ
The get_version method accepts a dict or list of tuples that
represent HTTP request headers that will be processed to find a
microversion header. Sometimes, for example in some middlewares,
direct access to a headers dict will not be available and only the
WSGI environ will be present.
This change provides a utility method which creates a new dict of
headers: headers_from_wsgi_environ. This mode was chosen to make it
clear that a copy of the environ is being made, not the environ
itself as we really don't want to be passing that as some values in
it will not be simple objects (strings and numbers) and we do not
know what other middleware might have done or want to do with it.
Internal to get_version any attempt to get a header named 'FOO' will
fall back to looking for the WSGI equivalent of 'HTTP_FOO'.
README.rst has been updated to indicate the new style.
This change is backwards compatible, existing clients will not
notice.
Reviewed: https:/ /review. openstack. org/495356 /git.openstack. org/cgit/ openstack/ microversion- parse/commit/ ?id=bd003b52a50 76905ceadf514c4 d360fee545bfc5
Committed: https:/
Submitter: Zuul
Branch: master
commit bd003b52a507690 5ceadf514c4d360 fee545bfc5
Author: Chris Dent <email address hidden>
Date: Fri Aug 18 16:42:20 2017 +0100
Provide a helper method to get headers from environ
The get_version method accepts a dict or list of tuples that
represent HTTP request headers that will be processed to find a
microversion header. Sometimes, for example in some middlewares,
direct access to a headers dict will not be available and only the
WSGI environ will be present.
This change provides a utility method which creates a new dict of from_wsgi_ environ. This mode was chosen to make it
headers: headers_
clear that a copy of the environ is being made, not the environ
itself as we really don't want to be passing that as some values in
it will not be simple objects (strings and numbers) and we do not
know what other middleware might have done or want to do with it.
Internal to get_version any attempt to get a header named 'FOO' will
fall back to looking for the WSGI equivalent of 'HTTP_FOO'.
README.rst has been updated to indicate the new style.
This change is backwards compatible, existing clients will not
notice.
Change-Id: I5262031d9cde03 78eabe342c19130 91658c3bf9b
Closes-Bug: #1579772