Calibration of free-space and fiber-coupled single-photon detectors