Encode the form params if the body is given as a Hash.
191149
def form_body
      if body.is_a?(Hash)
        body.map do |k,v|
          [AwsRequest.aws_encode(k), AwsRequest.aws_encode(v)].join("=")
        end.join("&")
      else
        body
      end
    end
1187658
def encode_params(self, data=None, **kwargs):
        
        if isinstance(data, basestring):
            raise ValueError("Data must not be a string.")
        if data is None:
            return b"", self.content_type

        fields = to_key_val_dict(data or "")
        try:
            body = json.dumps(fields)
        except:
            body = json.dumps(fields, encoding='latin-1')

        return str(body).encode(), self.content_type
41245
private byte[] encodeParameters(Map<String, String> params, String paramsEncoding) {
        StringBuilder encodedParams = new StringBuilder();
        try {
            for (Map.Entry<String, String> entry : params.entrySet()) {
                encodedParams.append(URLEncoder.encode(entry.getKey(), paramsEncoding));
                encodedParams.append('=');
                encodedParams.append(URLEncoder.encode(entry.getValue(), paramsEncoding));
                encodedParams.append('&');
            }
            return encodedParams.toString().getBytes(paramsEncoding);
        } catch (UnsupportedEncodingException uee) {
            throw new RuntimeException("Encoding not supported: " + paramsEncoding, uee);
        }
    }
1283171
def params_encode(params)
      params.map { |k, v| [OoAuth.escape(k), OoAuth.escape(v)] }.sort.map { |k, v| "#{k}=#{v}" }.join('&')
    end
113494
function customHash(req, body) {
  const hash = crypto.createHash('md5');

  updateHash(hash, req);
  hash.write(body);

  return hash.digest('hex');
}
963963
def _sanitize_params(params)
      Hash[params.map { |key, value| [key.to_sym, _sanitize_value(key, value)] }].freeze
    end
1330434
def process_url_params url, headers
      url_params = {}
      headers.delete_if do |key, value|
        if 'params' == key.to_s.downcase && value.is_a?(Hash)
          url_params.merge! value
          true
        else
          false
        end
      end
      unless url_params.empty?
        query_string = url_params.collect { |k, v| "#{k.to_s}=#{CGI::escape(v.to_s)}" }.join('&')
        url + "?#{query_string}"
      else
        url
      end
    end
1272876
function encode(params) {
        var data, property, className;

        if(params === null){
            return params;
        }

        className = Object.prototype.toString.call(params).replace('[object ', '').replace(']', '');

        if ( className == 'Object' ) {
            data = {};

            Object.keys(params).forEach(function (property) {
                if ( (typeof params[property] !== 'undefined') && (typeof params[property] !== 'function') ) {
                    data[property.toString().underscore()] = this.encode(params[property]);
                }
            }, this);

        } else if (className == 'Array') {

            data = params.map(function (value) {
                return this.encode(value);
            }, this);

        } else {
            data = params;
        }

        return data;
    }
1212089
def body=(value)
      value = [] if !value || value == ''
      super(value.respond_to?(:each) ? value : [value.to_s])
    end
910320
def encode_body_for_create
      if self.body.present?        
        if binary?
          self.body = Base64.encode64(self.body)
        elsif
          denc = detect_encoding
          self.body = self.body.encode('utf-8', denc)
        end
      end 

      true
    end
346843
def form_to_params(fn=None, return_json=True):
    
    def forms_to_params_decorator(fn):
        @handle_type_error
        @wraps(fn)
        def forms_to_params_wrapper(*args, **kwargs):
            kwargs.update(
                dict(request.forms)
            )

            if not return_json:
                return fn(*args, **kwargs)

            return encode_json_body(
                fn(*args, **kwargs)
            )

        return forms_to_params_wrapper

    if fn:  # python decorator with optional parameters bukkake
        return forms_to_params_decorator(fn)

    return forms_to_params_decorator
105936
function(params) {
    var encode = encodeURIComponent,
      p = [],
      key;
    for (key in params) p.push(encode(key) + '=' + encode(params[key]));

    return p.join('&');
  }
784362
function serializeHash() {
      var hash = {}
      eachFormElement.apply(function (name, value) {
        if (name in hash) {
          hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]])
          hash[name].push(value)
        } else hash[name] = value
      }, arguments)
      return hash
    }
1231331
def to_hash
      stringified_params = Hash[parameters.map { |key, val| [key.to_s, val] }]
      base_hash.merge(stringified_params)
    end
133286
function encodeParams(cache, API_URL, params) {
  var obj = {}, v;
  for (var k in params) {
    if (!params.hasOwnProperty(k)) continue;
    v = obj[k] = encode(cache, API_URL, params[k]);
    if (!v) return;
  }
  return obj;
}
1006820
def request_body(query)
      params = {}

      query.each do |key, value|
        next if value.nil?
        value = value.map(&:to_s).join(' ') if value.is_a? Array
        params[key] = value
      end

      URI.encode_www_form params
    end
638642
def to_h
      PARAMETERS.each_with_object({}) do |param, hash|
        next if send(param).nil?

        hash[param] = send(param)
      end
    end