Conversation
|
@talentlessguy It seems like the switch was generally less painful than I was expecting! However, one problem that fails the test suite and makes this unmergeable for the moment is that tinyhttp doesn't seem to play well with supertest (or vice versa, I suppose). It appears that supertest expects the Express instance that is passed to it to have a method called Any idea how to circumnavigate this? |
|
the easiest solution is this: const server = app.listen()
const request = supertest(server)tinyhttp has such thing in its own tests |
|
Seems like that did do the trick, thank you! 🎉 The final failing test has to do with csurf; the pattern for custom responses in CSRF token failures according to their README is as it's implemented below: Lines 100 to 106 in c4f2c72 However, tinyhttp's first callback parameter isn't Is there an established pattern on how to deal with this case? |
|
Alright, looks like I finally got the One possible future gotcha is around the csurf error handling, in that if other functionality needs to catch errors in the future, they're going to overwrite each others' error handlers. It's not a problem for now, though. Having done a few unscientific benchmarks, looks like Sapling with tinyhttpExpress |
Codecov Report
@@ Coverage Diff @@
## master #200 +/- ##
=======================================
Coverage 98.21% 98.21%
=======================================
Files 36 36
Lines 4415 4416 +1
=======================================
+ Hits 4336 4337 +1
Misses 79 79
Continue to review full report at Codecov.
|
|
Tests written and passing, merge conflicts solved, and even the lockfile finally agreed to work! Happy to merge this and enjoy the 36% performance improvement! |
Spike PR to explore converting from Express to tinyhttp, to see how difficult it is, and what kind of performance boost it may provide.
Closes #97.
Notes
ApptoTinyHTTPin order to avoid wider confusion with the pre-existing SaplingAppobject.sirv, seems to be a seamless drop-in replacement