An example of the Epic Stack with CSRF protection on forms
by kentcdoddsTypeScript
Last 12 weeks · 0 commits
2 of 6 standards met
I've just used this example to add csrf to the site I was working on, and tripped over an issue that the function needs to be given the response before the body of it has been accessed. e.g. this doesn't work (it throws due to the request body "having been used"): This does work: This also works Since I'd been wanting to wrap the verify in a try/catch and send back the contents of the form data in the catch clause's error, I'd defaulted to using the first way only to be very confused when the catch clause was firing (the error object seemed to be empty as a result of misconfiguring winston, so I wasn't getting any useful information from it). It's an unexpected limitation that is really easy to trip over. (Thank you so much for your work and examples on the Epic Stack!)
Repository: kentcdodds/epic-stack-with-csrf. Description: An example of the Epic Stack with CSRF protection on forms Stars: 12, Forks: 3. Primary language: TypeScript. Languages: TypeScript (92.1%), CSS (4.8%), JavaScript (2.2%), Dockerfile (0.9%). Topics: epic-stack, epic-stack-example. Open PRs: 0, open issues: 0. Last activity: 3y ago. Community health: 42%. Top contributors: kentcdodds.