Support setting headers on any part of the request

This is just a rebase against the current upstream.