Modify params in Gaelyk, and then redirect

52 views Asked by At

I want to redirect user by post request to some server.

I have initial form, which is filled by user, and then I want to modify params, add extra ones, and then redirect user to final destination.

Initially I have tried to work via redirect method. But it make's GET request.

Then I used

response.status = 307
response.addHeader("Location", response.encodeRedirectURL("https://…"))

Before that piece of code I used

params.someParam = "some_info"

It looks like I modified local copy of params map and it didn't attach to my request.

I see in browser console, that code 307 makes redirect work, but request contains only old params.

So my question is: "Is there any way to add/modify post params before redirect?"

1

There are 1 answers

2
musketyr On BEST ANSWER

You have to encode them in the url

redirect "/newUrl?${params.toQueryString()}"

in your case

response.addHeader("Location", 
    response.encodeRedirectURL("https://…?${params.toQueryString()}"))