Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'Access-Control-Allow-Headers',
'Authorization, Content-Type, x-xsrf-token, Pragma, Cache-Control',
);
res.header(
'Access-Control-Expose-Headers',
'Authorization, Error-Data, x-xsrf-token',
);
res.header('Access-Control-Allow-Credentials', 'true');
let mockCookie = cookie.parse(req.headers.cookie || '')['apimockid'];
res.cookie('apimockid', mockCookie);
// Retrieve a handler which handles state (can be pretty much any handler)
let handler = ioc_container.default
.get('Middleware')
.getMatchingApplicableHandler(
{
method: 'PUT',
url: '/ngapimock/variables',
},
{},
);
// Loop over the mocks of the handler and find the availability call
handler.state._mocks.forEach(function(mock) {
const strippedUrl = req.url.split('?')[0];
const isSameStaticRequest =
strippedUrl.startsWith(`/${mock.request.url}`) &&
strippedUrl.endsWith('.json');