Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation Clarification - createMiddleware and context #411

Open
jtmcdole opened this issue Feb 12, 2024 · 3 comments
Open

Documentation Clarification - createMiddleware and context #411

jtmcdole opened this issue Feb 12, 2024 · 3 comments
Assignees
Labels
package:shelf type-enhancement A request for a change that isn't a bug

Comments

@jtmcdole
Copy link

Request and Response are immutable and so is the context member. The documentation for context makes it seem easy to signal information to middleware and handlers.

  1. Update context to be clear that modifying it on a request or response requires calling .change() on those objects
  2. Adding a note in createMiddleware about the inability to forward a new request/response

Happy to work on this. Would also be happy to have a way to easily pass information down a pipeline without manipulating the request object.

@kevmoo kevmoo added the type-enhancement A request for a change that isn't a bug label Feb 12, 2024
@kevmoo
Copy link
Member

kevmoo commented Feb 12, 2024

Go for it!

@kroikie
Copy link

kroikie commented Sep 8, 2024

Hi @kevmoo, just to be clear: is it the intension that createMiddleware not allow the forwarding of a "changed" request?

I think I made the same assumption as @jtmcdole that createMiddleware would allow me to update the request, especially the context or request headers before it is passed on to the next middleware or handler.

Thanks for any clarification.

@kevmoo
Copy link
Member

kevmoo commented Sep 8, 2024

Yes! You can use createMiddleware to update a request and/or a response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:shelf type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants