What parts of a HTTP POST web request need to be URL Encoded?

213 Views Asked by At

I have been browsing for an answer, but I am a bit confused about which parts of POST data need to be URL encoded. I am submitting an HTTP post request with name/value parameters, and content-type: application/x-www-form-urlencoded.

Do I need to build my entire parameter string ie) encode(postData) or and then encode each name/value pair separately? encode(paramName) + "=" + encode(paramValue) + "&"

From Chrome developer tools the raw request I'm trying to replicate looks like option 2, but what I've read online seems to indicate option 1.

Thanks

1

There are 1 best solutions below

1
On BEST ANSWER

From application/x-www-form-urlencoded or multipart/form-data? and Forms in HTML documents:

Control names and values are escaped

So, option 2.