function set(obj, key, val) {
  var v = obj[key];
  if (undefined === v) {
    obj[key] = val;
  } else if (isArray(v)) {
    v.push(val);
  } else {
    obj[key] = [v, val];
  }
}
Set `obj`'s `key` to `val` respecting
the weird and wonderful syntax of a qs,
where "foo=bar&foo=baz" becomes an array.

@param {Object} obj
@param {String} key
@param {String} val
@api private