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

[feature request]: RedirectAttributes with .redirect() ? #96

Open
resmo opened this issue Jan 10, 2024 · 3 comments · May be fixed by #137
Open

[feature request]: RedirectAttributes with .redirect() ? #96

resmo opened this issue Jan 10, 2024 · 3 comments · May be fixed by #137

Comments

@resmo
Copy link

resmo commented Jan 10, 2024

I don't know if this is even possible but it would be nice to have support for Springs RedirectAttributes when using

return HtmxResponse.builder()
          .redirect("/my-resource/1")
          .build();
@resmo resmo changed the title feature request: RedirectAttributes with .redirect() ? [feature request]: RedirectAttributes with .redirect() ? Jan 10, 2024
@wimdeblauwe
Copy link
Owner

What do you want to make possible that is not possible now?

@resmo
Copy link
Author

resmo commented Jan 10, 2024

I'd like to have a replacement for

    @GetMapping("/test")
    public String testRedirect(RedirectAttributes redirAttrs) {
        redirAttrs.addFlashAttribute("success", "an example message");
        return "redirect:/";
    }

but with a HtmxResponse:

    @HxRequest
    @GetMapping("/test")
    public HtmxResponse testRedirectHx(RedirectAttributes redirAttrs) {
        redirAttrs.addFlashAttribute("success", "an example message");
        return HtmxResponse.builder()
                .redirect("/")
                .build();
    }

@xhaggi xhaggi linked a pull request Oct 25, 2024 that will close this issue
@xhaggi
Copy link
Contributor

xhaggi commented Oct 25, 2024

@resmo I had the same issue and fixed it in #137.

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 a pull request may close this issue.

3 participants