Terahertz spectroscopy using quantum-cascade lasers