import * as http from 'http' ; import { httpHeaders } from '../../http' ; import Handler from '../../handler' ; import Registry from '../../registry' ; /** Abstract Handler for setting the mocks to passThroughs. */ abstract class SetMocksToPassThroughsHandler implements Handler { param registry param ngApimockId abstract setToPassThroughs ( registry , ngApimockId ? ) ; param registry param ngApimockId return abstract getSelections ( registry , ngApimockId ? ) ; inheritDoc handleRequest ( request , response , next , registry , ngApimockId ) { this . setToPassThroughs ( registry , ngApimockId ) ; const selections = this . getSelections ( registry , ngApimockId ) ; response . writeHead ( 200 , httpHeaders . CONTENT_TYPE_APPLICATION_JSON ) ; response . end ( JSON . stringify ( { mocks : registry . mocks , selections : selections } ) ) ; } } export default SetMocksToPassThroughsHandler ;