Today I learned

Encoding POST request body

Edit this Post Opens in new tab

Today I learned, that passing unencoded text into the body of a POST request is a bad idea. It could result in security issues and therefore always should be encoded.

One approach to resolve this is using URLSearchParams. You can learn more about the API on mdn: https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams Opens in new tab

Jake Archibald wrote a blog post about this topic, where he explains it in more depth: https://jakearchibald.com/2021/encoding-data-for-post-requests Opens in new tab


I hope you enjoyed this post and learned something new. If you have any questions, feel free to reach out to me via Email Opens in new tab.

If you want to support me, you can buy me a coffee. I would be very happy about it!

☕️ Buy me a coffee ☕️

I wish you a wonderful day! Marco