Skip to content

fix: Add middleware to convert redirects for Datastar requests - #5

Merged
dancycodes merged 1 commit into
mainfrom
develop
Oct 25, 2025
Merged

dancycodes merged 1 commit into
mainfrom
develop

Conversation

@dancycodes

@dancycodes dancycodes commented Oct 25, 2025 •

Copy link
Copy Markdown
Owner

Introduces ConvertRedirectsForDatastar middleware to intercept standard Laravel redirect responses for Datastar requests and convert them into Hyper-compatible SSE responses with client-side JavaScript redirects. Updates HyperRedirect to ensure session flash data persists correctly by compensating for dual session aging, and registers the middleware globally in HyperServiceProvider. Adds comprehensive unit tests for both middleware and HyperRedirect flash data handling.

Description

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test coverage improvement

Motivation and Context

Closes #

Changes Made

How Has This Been Tested?

  • Unit tests added/updated
  • Feature tests added/updated
  • Browser tests added/updated (if applicable)
  • Manual testing performed

Test Configuration:

  • Laravel Version:
  • PHP Version:
  • Operating System:

Checklist

  • My code follows the code style of this project (Laravel Pint)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published
  • I have updated the CHANGELOG.md (if applicable)

Breaking Changes

N/A

Screenshots (if applicable)

Additional Notes

Introduces ConvertRedirectsForDatastar middleware to intercept standard Laravel redirect responses for Datastar requests and convert them into Hyper-compatible SSE responses with client-side JavaScript redirects. Updates HyperRedirect to ensure session flash data persists correctly by compensating for dual session aging, and registers the middleware globally in HyperServiceProvider. Adds comprehensive unit tests for both middleware and HyperRedirect flash data handling.
@dancycodes
dancycodes merged commit ea548a2 into main Oct 25, 2025
8 of 12 checks passed
@dancycodes
dancycodes deleted the develop branch October 25, 2025 06:44
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