Fix header case-insensitivity and mutation of passed headers object