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 · 2 comments
Open

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

resmo opened this issue Jan 10, 2024 · 2 comments

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();
    }

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

No branches or pull requests

2 participants