shinyworks / cookies

Use Browser Cookies with 'shiny'
https://shinyworks.github.io/cookies/
Other
32 stars 4 forks source link

Provide target for set_cookie_response() #19

Closed jonthegeek closed 2 years ago

jonthegeek commented 2 years ago

Export a function that takes a location as an argument, and generates HTML that will redirect to that location, for use as a content argument in set_cookie_response().

I can't think of another way to use set_cookie_response(), really, so this should probably be a wrapped version of that, and be called out as the main use case.

I know how to javascript-redirect (location.replace), but this should be either as an http header or as the content of the page itself, and I need to dig to sort out what's "proper".

jonthegeek commented 2 years ago

It looks like sending an http-redirect status code 307 and a Location header with the new location (along with the set-cookie) is the way to go. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location

Note that the Location can be relative to the original request!

To test: does it deal with query parameters?