[Middleware] Confusion around onBeforeRequest hook
Hey team!
I'm playing with the latest version of Solid start and noticed something that might be me, misunderstanding the doc.
I'm having a middleware
onBeforeResponse
that is supposed to check the response content type and if it's HTML, modify the body to add some stuff in the <head> tag (think about a CSRF token for example). To do so, I'm using the hook onBeforeRequest
. This hook gives me access to an event
param and a response
param. The response is empty, no body, no headers, nothing. If my hook just returns the response that was given, my site breaks.
Can somebody tell me what this hook is supposed to do?
Am I missing something?
Thanks!
Some code:
0 Replies