Skip to content

Conversation

@AyushCoder9
Copy link
Contributor

update compose so middleware can replace error responses when context.error is set, enabling patterns like c.redirect() after an error
add regression test covering the /hello?name=error scenario to ensure middleware can trigger a redirect post-error
captures the behavior reported in #4530 where redirects triggered in middleware were ignored after an error

Allow middleware to override error responses by checking context.error
in addition to isError flag. This enables middleware to handle errors
gracefully (e.g., redirecting) even after the error handler has
already set a response and finalized the context.

Fixes honojs#4530
@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.52%. Comparing base (342ff3b) to head (3ded05b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4540   +/-   ##
=======================================
  Coverage   91.52%   91.52%           
=======================================
  Files         172      172           
  Lines       11221    11221           
  Branches     3255     3255           
=======================================
  Hits        10270    10270           
  Misses        950      950           
  Partials        1        1           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant