iron-ajax
iron-ajax copied to clipboard
_wwwFormUrlEncode cant handle nested objects properly
when contentType is set to 'application/x-www-form-urlencoded' ajax-request is parsing given object (if it's not string) to urlencoded representation of object. Parsing works well for "one layer" object but for nested objects it fails.
proposed soultion in pull request (it also support arrays)
Steps to reproduce:
for iron-ajax element set following attributes:
content-type="application/x-www-form-urlencoded" body={busList : {tram : [1]}}
Expected :
send request with data filled with "busList%5Bbus%5D=&busList%5Btram%5D%5B%5D=10&busList%5Btrain%5D="
Observed:
send request with data filled with "buslist=Object object"
I'd lean towards the encoding scheme that we used for GET params. The reason that we went with that encoding was that it maximizes user control over how their data is encoded, because there doesn't appear to be a clear standard for how to map nested data into a form encoding, and iron-ajax needs to be useful to people with a variety of server software.