fix(router): add ability to recover from malformed url (#23283)
Fixes #21468 PR Close #23283
This commit is contained in:
@ -115,12 +115,20 @@ export function setupTestingRouter(
|
||||
opts?: ExtraOptions | UrlHandlingStrategy, urlHandlingStrategy?: UrlHandlingStrategy) {
|
||||
const router = new Router(
|
||||
null !, urlSerializer, contexts, location, injector, loader, compiler, flatten(routes));
|
||||
// Handle deprecated argument ordering.
|
||||
if (opts) {
|
||||
// Handle deprecated argument ordering.
|
||||
if (isUrlHandlingStrategy(opts)) {
|
||||
router.urlHandlingStrategy = opts;
|
||||
} else if (opts.paramsInheritanceStrategy) {
|
||||
router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
|
||||
} else {
|
||||
// Handle ExtraOptions
|
||||
|
||||
if (opts.malformedUriErrorHandler) {
|
||||
router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
|
||||
}
|
||||
|
||||
if (opts.paramsInheritanceStrategy) {
|
||||
router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user