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): make sure onBeforeResponse and onAfterResponse are called with error code #756

Merged
merged 10 commits into from
Jun 19, 2024

Conversation

imslepov
Copy link
Contributor

πŸ”— Linked issue

Closes #754

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@imslepov imslepov marked this pull request as draft May 20, 2024 06:07
@imslepov imslepov marked this pull request as ready for review May 24, 2024 19:40
@imslepov
Copy link
Contributor Author

imslepov commented Jun 3, 2024

/cc @pi0 can you review my PR? πŸ™ This fix is very necessary for my app.

@pi0 pi0 force-pushed the fix-global-hooks branch from 85a18c6 to 4a25b29 Compare June 19, 2024 00:16
Copy link

codecov bot commented Jun 19, 2024

Codecov Report

Attention: Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.67%. Comparing base (a58d7c9) to head (ed3f579).
Report is 81 commits behind head on main.

Files Patch % Lines
src/app.ts 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #756      +/-   ##
==========================================
+ Coverage   77.83%   79.67%   +1.84%     
==========================================
  Files          47       54       +7     
  Lines        4286     5363    +1077     
  Branches      611      692      +81     
==========================================
+ Hits         3336     4273     +937     
- Misses        933     1071     +138     
- Partials       17       19       +2     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@pi0 pi0 changed the title fix(app,response): call global hooks if the request fails fix(node): make sure onBeforeResponse and onAfterResponse are called with error code Jun 19, 2024
@pi0
Copy link
Member

pi0 commented Jun 19, 2024

Thanks for PR and nice tests @imslepov ❀️

I have updated the implementation to minimize the required changes. Expected tests pass still but we call hooks only before sending response body.

In future, It should be cleaner but requires more additional core refactors later.

@pi0 pi0 merged commit b6a7763 into unjs:main Jun 19, 2024
5 checks passed
@imslepov imslepov deleted the fix-global-hooks branch June 19, 2024 06:38
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.

Cannot track status codes
2 participants