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

fix(node): hook calling order #789

Closed
wants to merge 1 commit into from
Closed

Conversation

imslepov
Copy link
Contributor

Relates to #756

There is a bug where if the onError hook handles the event (by setting event.handled = true), the onBeforeRequest and onAfterRequest hooks are not called 😅

In this PR, I made the changes:

  • Call onBeforeResponse hook before onError because onError may handle an error and the server may return a response.
  • The event.handled flag does not affect the calling hooks onBeforeResponse and onAfterRequest.

Copy link

codecov bot commented Jun 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.23%. Comparing base (a58d7c9) to head (66a4a0a).
Report is 99 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #789      +/-   ##
==========================================
+ Coverage   77.83%   86.23%   +8.40%     
==========================================
  Files          47       41       -6     
  Lines        4286     5043     +757     
  Branches      611      708      +97     
==========================================
+ Hits         3336     4349    +1013     
+ Misses        933      692     -241     
+ Partials       17        2      -15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pi0
Copy link
Member

pi0 commented Jun 26, 2024

Thanks for PR dear @imslepov ❤️

#792 changes the whole internal structure to make sure hooks are reliable.

in the meantime, i guess the issue exists for v1. You can rebase changes to it (probably new PR would be easier)

@imslepov
Copy link
Contributor Author

@pi0 Thanks! Amazing work on version 2.

Created PR for v1 fix - #793

@imslepov imslepov closed this Jun 26, 2024
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.

2 participants