Today I learned

Encoding POST request body

Edit this Post

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:

Jake Archibald wrote a blog post about this topic, where he explains it in more depth:

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

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