0

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

user1625624
  • 89
  • 1
  • 9
  • 1
    how are you building this request? Normally you shouldn't have to be building the request body yourself, just provide a key=value array/list/whatever to the underlying language's http library and let it do all the work for you. – Marc B Nov 10 '14 at 16:38

1 Answers1

0

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

Control names and values are escaped

So, option 2.

Community
  • 1
  • 1
CodeCaster
  • 131,656
  • 19
  • 190
  • 236
  • Quick and precise answer, thanks! The W3 document is where I should have gone first. The second part: Control names/values are listed in the order they appear in the document, is good to know too! – user1625624 Nov 10 '14 at 18:34