Comment 2 for bug 1579772

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to microversion-parse (master)

Reviewed: https://review.openstack.org/495356
Committed: https://git.openstack.org/cgit/openstack/microversion-parse/commit/?id=bd003b52a5076905ceadf514c4d360fee545bfc5
Submitter: Zuul
Branch: master

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.

    Change-Id: I5262031d9cde0378eabe342c1913091658c3bf9b
    Closes-Bug: #1579772