FrancMo
FrancMo

Reputation: 2689

Akka http redirect but change method from POST to GET

I have endpoint using POST method ( registering token for example ), after job done I want to redirect client to "/" url, but using GET not POST. How to achieve this ?

For now I have:

redirect("/", StatusCodes.PermanentRedirect)

Upvotes: 4

Views: 556

Answers (1)

Silvia Pina
Silvia Pina

Reputation: 413

What you want in this case is not a redirect with status code PermanentRedirect, but rather SeeOther (303). So you would have instead: redirect("/", StatusCodes.SeeOther)

You can check in RFC 7231, section 6.4.4: 303 See Other that this guarantees the behavior you describe.

Upvotes: 3

Related Questions