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

How its possible? #1

Closed
dyipon opened this issue Dec 13, 2021 · 2 comments
Closed

How its possible? #1

dyipon opened this issue Dec 13, 2021 · 2 comments

Comments

@dyipon
Copy link

dyipon commented Dec 13, 2021

Hi,

Im just curious, how your code is removing response headers if the real header/body is generating after all middlewares?

I checked a few another plugin, but they are more complex.

@nilskohrs
Copy link
Owner

There is a difference between header and body. The header is completely known and immutable at the moment the client receives the first bytes. The body however could still be unknown at this point. So after the next.ServeHTTP() has been executed the headers of all middlewares and a potential header response of the underlying service is known and therefor can be edited. As the body is unknown you need to do a lot more work to catch it midflight and resend. This is why it also needs more code to do so.

@dyipon
Copy link
Author

dyipon commented Dec 14, 2021

Thank you!

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

No branches or pull requests

2 participants