-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
I want to use ng-apimock to mock using real a settings file with a single value modified for each scenario. This is so I don't have to create copies of all the settings I don't want to change in multiple mock JSON files. I was expecting to be able to use Express middleware to do this
let featureScenarioWriter = function (req, res, next) {
console.log("The request:" + req);
//check request is for the settings file
//load the real settings file and modify the key\value matching what is in the response
//set the response to be the whole settings file with a single value changed
next();
};
app.set('port', 3000);
// process the api calls through ng-apimock
app.use(require('ng-apimock/lib/utils').ngApimockRequest);
// serve the mocking interface for local development
app.use('/mocking', express.static('./.tmp/ngApimock'));
app.use(featureScenarioWriter);
However no request ever reaches the featureScenarioWriter function. I presume this is because the response is ended by ngApimockRequest.
Should my custom middleware be called? Is there another way I could change one value in a file as part of a scenario?
Metadata
Metadata
Assignees
Labels
No labels