Skip to content

Conversation

scheidtdav
Copy link
Collaborator

This PR adds middleware to two endpoints as examples:

  • jsonResponseHeaders: Adds content-type headers to all response
  • jwtAuth: Finds and extracts the jwt from a request to check if there is a valid user authentication. The user is provided in the context for endpoints to be used.

Overall, with middleware being an unstable feature still, it seems to be a bit tricky to get the right typings for it..
A bit annoying but powerful.

The tests need to be adjusted a bit to make use of the middleware, because the current scheme only runs the loader/action functions directly, skipping over the middleware. Technically thats the better unit test and middleware functions could be tested separately. I think I prefer that, what do you think?

@scheidtdav scheidtdav requested a review from jona159 August 13, 2025 11:25
@scheidtdav scheidtdav marked this pull request as draft August 13, 2025 11:25
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant