REFACTOR: merges redirectTo implementation into one function (PR #10919)

See plugin-api for details.

This commit alsoslightly refactors redirectTo to make it more testable.

GitHub

@eviltrout I’m especially interested in your opinion of my lib url changes.

I thought it was confusing to have two redirectTo function in the same file, with a slightly different implementation. Also the top one was hard to stub.

Sadly this is not very usable in the end, as it can’t calls something that doesn’t exist…

The API might still be generally useful for other plugins, even if we can’t use it in styleguide? Plus the refactoring of redirectTo is useful?

Hmmmm… I’m kinda reluctant to keep things that don’t have direct use case… but ok, let’s see what robin thinks.

I too am reluctant to merge something that’s not being used anywhere. During refactoring efforts I’ll often grep the codebase and plugins and remove stuff that is no longer being used.

We could make a separate PR for the url improvements though.

The title of this pull request changed from “DEV: adds addServerSideOnlyPluginRoute plugin api” to "REFACTOR: merges redirectTo implementation into one function

@eviltrout I have updated the PR to only contain the lib/url change