import * as http from 'http' ; import { httpHeaders } from '../../http' ; import Registry from '../../registry' ; import Handler from '../../handler' ; /** Abstract Handler for Getting the mocks. */ abstract class GetMocksHandler implements Handler { param registry param ngApimockId return abstract getSelections ( registry , ngApimockId ? ) ; param registry param ngApimockId return abstract getEchos ( registry , ngApimockId ? ) ; param registry param ngApimockId return abstract getDelays ( registry , ngApimockId ? ) ; inheritDoc handleRequest ( request , response , next , registry , ngApimockId ) { const selections = this . getSelections ( registry , ngApimockId ) ; const echos = this . getEchos ( registry , ngApimockId ) ; const delays = this . getDelays ( registry , ngApimockId ) ; response . writeHead ( 200 , httpHeaders . CONTENT_TYPE_APPLICATION_JSON ) ; response . end ( JSON . stringify ( { mocks : registry . mocks , selections : selections , delays : delays , echos : echos , recordings : registry . recordings , record : registry . record } ) ) ; } } export default GetMocksHandler ;