-
Notifications
You must be signed in to change notification settings - Fork 68
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
Unable to modify response #108
Comments
@chhsiao90 Do you want me to implement this feature or may be easier for you to do it? Quite urgent for me at the moment and happy to develop this if needed. We need to do this for both Http1 and Http2 as well as WebSockets. But Http1 and Http2 is critical for now. |
I commit a change to allow http2 response interception in fc4abec. With the update, it's possible to intercept the response data with current implementation by rewriting the It's not the most straightforward way to intercept data. The most straightforward way is to intercept the full response, and return another full response, ex: a method like So I would prefer to provide some helper interceptors to simplify the process of interception based on current implementation. I will have some draft by this week. |
@chhsiao90 I completely agree. One amazing part of NITM is how fast it is and we shouldn't compromise it. My use case and I am assuming most use cases would include intercepting Content-Type of HTML and replacing it with their own content. If the helper can provide interception with the header being available, that would be fantastic and potentially even a better helper to just intercept by Content-Type with the HTML content-type made easily available. |
May I know how do you plan to inject javascript inside a HTML page? Append the script to the end of html? Find specific tag and replace? It will help me to decide how to implement the API. |
More likely will be appended to the script tag at the end of the file. |
@chhsiao90 Changes look good. Can we push a release if possible? Thanks! |
@chhsiao90 I don't believe there is call made in Http2EventHandler to modify the response data? For e.g. adding javascript injection to a response etc.
It would be great if we can modify the response object using the listener interface.
The text was updated successfully, but these errors were encountered: