How to use the @ng-apimock/core/dist/ioc-container.default function in @ng-apimock/core

To help you get started, we’ve selected a few @ng-apimock/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rickvandermey / angular-starterkit / mockserver / mockserver.js View on Github external
'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');

@ng-apimock/core

ng-apimock core module

MIT
Latest version published 3 months ago

Package Health Score

79 / 100
Full package analysis