-
Notifications
You must be signed in to change notification settings - Fork 40
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
Allow autoStoreData to work on the root page #259
Comments
is it not working for you? that line is about POST > GET redirect. The autostoredata line is here, and works on all paths: https://github.com/nhsuk/nhsuk-prototype-kit/blob/main/app.js#L96 Even the line you highlighted for redirects looks like it works on |
The regex doesn't match > "/".match(/^\/([^.]+)$/)
null
>
> "/home/".match(/^\/([^.]+)$/)
[ '/home/', 'home/', index: 0, input: '/home/', groups: undefined ] |
In fact, if you want to just redirect all POST to GET while keeping the URL the same, there's no need for any regex: app.post("*", (req, res) => {
res.redirect(req.originalUrl);
}); I'll try this out later and submit a PR |
oh yeh sorry you're right, at least one char: the original seems to not want to match a |
If you feel like it you can do a PR to the GOV.UK kit: |
and I see we have a fix that isnt in the NHS kit - it retains query strings |
The regex here is enabling autoStoreData functionality on all pages except the home page
/
.This should be changed to all pages including homepage.
nhsuk-prototype-kit/app.js
Line 216 in 8b6a195
Edit:
I didn't really word this properly. I should have said:
The regex here is handling the POST > GET redirect which is necessary for the autoStoreData functionality on all pages except the home page
/
.The text was updated successfully, but these errors were encountered: