I have an API that's taking credentials (username/password) and authenticating with Keystone on behalf of the user. When rate limiting is enabled in Keystone, Keystone may return a 429 response. When that happens, I want to proxy this response to the user. I also want to forward the Retry-After header sent by Keystone, but there is no way to get at the headers of a 4xx response with the way that the error handling of ProviderClient.Request() is currently implemented. To fix this problem, I propose that ErrUnexpectedResponseCode include the response headers.
Besides the Retry-After header for 429, this can also be useful to obtain the X-Openstack-Request-Id response header to report back to the user along with the error message.