Submitting Data via the Request Body: POST Requests

Let's learn how to submit data through the request body instead of using query parameters.

Why submit data through the request body?

Submitting form data using query parameters is nice and easy, but it should only be used for really simple forms that only have short-term effects. Most forms are used to collect information from the user, which is then going to be saved to a database. Some forms have sensitive or personal data that should not visibly end up in the URL. Imagine a username and a password being submitted as query parameters: /register username=coolguy1984&password=ilovecookies. This URL ends up in the browser’s history. The username and password will also show up in server log files. So in practice, most form data will be submitted not as query parameters but, as part of the request body.

Get hands-on with 1400+ tech skills courses.