Fix #get_or_mock_query so that it accepts and passes along headers, if specified