mirror of
https://github.com/tenrok/axios.git
synced 2026-05-30 15:24:11 +03:00
c05ad48952
Added `toURLEncodedForm` helper; Added automatic payload serialization to `application/x-www-form-urlencoded` to have parity with `multipart/form-data`; Added test of handling `application/x-www-form-urlencoded` body by express.js; Updated README.md; Added missed param in JSDoc; Fixed hrefs in README.md; Co-authored-by: Jay <jasonsaayman@gmail.com>
19 lines
513 B
JavaScript
19 lines
513 B
JavaScript
'use strict';
|
|
|
|
var utils = require('../utils');
|
|
var toFormData = require('./toFormData');
|
|
var platform = require('../platform/');
|
|
|
|
module.exports = function toURLEncodedForm(data) {
|
|
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
visitor: function(value, key, path, helpers) {
|
|
if (platform.isNode && utils.isBuffer(value)) {
|
|
this.append(key, value.toString('base64'));
|
|
return false;
|
|
}
|
|
|
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
}
|
|
});
|
|
};
|