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

Cannot answer request on event 'onRequestEnd' #187

Open
DblK opened this issue Mar 17, 2019 · 5 comments
Open

Cannot answer request on event 'onRequestEnd' #187

DblK opened this issue Mar 17, 2019 · 5 comments

Comments

@DblK
Copy link

DblK commented Mar 17, 2019

Hi,

I try to match some query to do some specific answer. Until now, I was using the event onRequest which was working fine until I wanted to handle body request.
After mapping onRequestData & onRequestEnd I finally have all information need: rawBody.
However, I cannot respond to the client. It seems somewhere in the library, a response is sent to the client. Moreover, the proxy has already made the query to the server.
I which the connection to occur only after all onRequestEnd.

Could you pinpoint where it is and how to avoid it? Or maybe to have all body request in onRequest event?

Thank you

@DblK
Copy link
Author

DblK commented Mar 25, 2019

To complete my issue, I know have the body of the request but the connection to the server is established during onRequestHeaders. At this point I wish to have the server connection but only after the requestEnd to be able to handle the body and then maybe or maybe not make connection to server.

Any idea?

@kics223w1
Copy link

Hi, did you solve the problem 🤔 I'll very appreciate if you share with me any idea @DblK

@DblK
Copy link
Author

DblK commented Mar 31, 2023

@kics223w1 yes I did solve my issue, making my own library yamp.

@kics223w1
Copy link

@DblK Nice, I also solved the problem. I'll submit pull request which provide example how to do that soon.

@kics223w1
Copy link

  • This is my custom node-http-mitm-proxy library.
  • This library allows you can get the request body before the onRequest event is triggered.
  • I.e. If the body doesn't meet your condition, you can prevent it to proceed to the real server.

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