node-modules / urllib

Request HTTP(s) URLs in a complex world.
MIT License
729 stars 118 forks source link

post request body sended without complex fields #367

Closed tohodov closed 2 years ago

tohodov commented 3 years ago

I use the library like this:

var body = { simpleField: 'text', complexField: { name: 'text', value=42 } }; var options = { method: 'POST', dataType: 'json', data: body }; urllib.request(url, options, function(err, json, res) { //check responce };

I was very surprised when I found out that the body is not sent as json (application/x-www-form-urlencoded). But I was even more surprised when I found out that some fields are missing in the body!

Is this a mistake in your code, or am I a fool and using a brilliant tool incorrectly?