Do not send parameters with undefined to body
gewisser opened this issue · comments
src\url\index.js:58
/**
* Encodes a Url parameter string.
*
* @param {Object} obj
*/
Url.params = function (obj) {
var params = [], escape = encodeURIComponent;
params.add = function (key, value) {
if (isFunction(value)) {
value = value();
}
if (value === null) {
value = '';
}
this.push(escape(key) + '=' + escape(value));
};
serialize(params, obj);
return params.join('&').replace(/%20/g, '+');
};
Vue.http.options.emulateJSON = true;
It is a little uncomfortable when value equals undefined. A line is sent to the backend:
What is Expected?
body = param=1
What is actually happening?
body = param=1¶m2=undefined¶m3=undefined
I could work on this.