-
-
Notifications
You must be signed in to change notification settings - Fork 432
Conversation
Thanks — I still strongly feel that Polka should adopt Express's behaviour here (partly because it's just much easier to understand, but also because it would make it simpler to migrate existing Express apps), but in lieu of that...! Before I merge, any idea what's going on with the test failures? |
This is up to you, of course! As mentioned, there is an avenue to deal with this currently, it's just not super ideal. While I (now) understand your stance, unfortunately it changes the entirety of Polka. It might be possible to do before the 1.0 release (or a future major), but it does require a full rewrite :/ No idea on the test failures. I didn't even look into what it's doing tbh. That one passes locally, but a bunch of others fail here (cookie management & whatnot). Maybe rerunning both test suites will do the trick? lol 😅 |
super weird — when I checkout this branch locally, I get the same errors as Travis and Appveyor. Can't figure out why it'd be related to these changes (though i haven't looked deeply yet). Will have to investigate further when i'm not at work |
I'll try to do the same tonight or tomorrow night, including fresh installs. Sorry for the trouble |
Ah, found it 😆 The failing test navigates to Fix incoming~ |
~> leaked into another test’s route
thanks! released 0.15.4. Opened an issue on the docs repo — not exactly sure where to put it https://github.com/sveltejs/sapper.svelte.technology/issues/24 |
When Sapper runs as a top-level middleware, it (strongly) assumes it's the final handler for any/all requests on that domain. While this is 100% desired in most cases (and especially when relegated to a
basepath
), it does make it near-impossible to prevent this behavior in the 1-2% of cases where an escape hatch is needed.More specifically, Polka users are forced to run everything as a root-level middleware, even if a sub-application is meant to control its own basepath. This is currently the only work around in this case:
With this feature, Polka (or any) users can bypass Sapper's routing and allow their legacy/sub/third-party/whatever apps to run on the same server, without worrying about middleware sequencing.
The
options.ignore
can be an instance ofRegExp
,Function
,String
, or anArray
of any combination.In the middleware composition, a new middleware is added only if/when the
options.ignore
is defined. Thereq.__SAPPER__IGNORE__
boolean will be set & is used in the following middlewares to exit early, avoiding any sapper-related work that isn't desired for the current, incoming request.