Generate the format expected by HTTP Headers from parameters.

        Args:
          params (dict): {key: value} to convert to key=value

        Returns:
          A formatted header string.
760801
def format_auth_params(params):
        
        parts = []
        for (key, value) in params.items():
            if value:
                parts.append('{}="{}"'.format(key, value))
        return ", ".join(parts)
1005434
def get_headers(environ):
    
    for key, value in compat.iteritems(environ):
        key = str(key)
        if key.startswith("HTTP_") and key not in ("HTTP_CONTENT_TYPE", "HTTP_CONTENT_LENGTH"):
            yield key[5:].replace("_", "-").lower(), value
        elif key in ("CONTENT_TYPE", "CONTENT_LENGTH"):
            yield key.replace("_", "-").lower(), value
32451
def format_parameter(parameter)
      formatted_parameter = parameter.instance_of?(Time) ? iso_format(parameter) : parameter.to_s
      WEBrick::HTTPUtils.escape formatted_parameter
    end
1059470
def _EncodeParameters(self, parameters):
        

        if parameters is None:
            return None
        else:
            return urlencode(dict([(k, self._Encode(v)) for k, v in list(parameters.items()) if v is not None]))
454410
def gen_headers(opts)
      now = Time.now.httpdate
      sig = gen_signature('date: ' + now)

      headers = [[ 'Date',           now        ],
                 [ 'Authorization',  sig        ],
                 [ 'User-Agent',     HTTP_AGENT ],
                 [ 'Accept-Version', '~1.0'     ]]


       # headers for conditional requests (dates)
       for arg, conditional in [[:if_modified_since,   'If-Modified-Since'  ],
                                [:if_unmodified_since, 'If-Unmodified-Since']]
        date = opts[arg]
        next unless date

        date = Time.parse(date.to_s) unless date.kind_of? Time
        headers.push([conditional, date])
      end

      # headers for conditional requests (etags)
      for arg, conditional in [[:if_match,      'If-Match'     ],
                               [:if_none_match, 'If-None-Match']]
        etag = opts[arg]
        next unless etag

        raise ArgumentError unless etag.kind_of? String
        headers.push([conditional, etag])
      end

      origin = opts[:origin]
      if origin
        raise ArgumentError unless origin == 'null' || origin =~ CORS_ORIGIN_REGEX
        headers.push([ 'Origin',  origin ])
      end

      custom_headers = opts.keys.select { |key| key.to_s.start_with? 'm_' }
      unless custom_headers.empty?
        headers += custom_headers.map do |header_key|
          [ symbol_to_header(header_key), opts[header_key] ]
        end
      end

      # add md5 hash when sending data
      data = opts[:data]
      if data
        md5 = Digest::MD5.base64digest(data)
        headers.push([ 'Content-MD5', md5 ])
      end

      return headers
    end
1201708
function formatParameters(params)
{
    var sortedKeys = [],
        formattedParams = ''

    // sort the properties of the parameters
    sortedKeys = _.keys(params).sort()

    // create a string of key value pairs separated by '&' with '=' assignement
    for (i = 0; i < sortedKeys.length; i++)
    {
        if (i !== 0) {
            formattedParams += '&'
        }
        formattedParams += sortedKeys[i] + '=' + params[sortedKeys[i]]
    }

    return formattedParams
}
387598
def get(self, get_params, block):
        
        value = "{%s}" % self.key
        try:
            value = value_ = get_params(self.key)
            if self.format.startswith(":"):
                # if a parameter has been set to be formatted as a numeric
                # type then we see if we can coerce it to be.  This allows
                # the user to format types that normally would not be
                # allowed eg '123' it also allows {:d} to be used as a
                # shorthand for {:.0f}.  Use {:g} to remove insignificant
                # trailing zeroes and the decimal point too if there are
                # no remaining digits following it.  If the parameter cannot
                # be successfully converted then the format will be removed.
                try:
                    if "ceil" in self.format:
                        value = int(ceil(float(value)))
                    if "f" in self.format:
                        value = float(value)
                    if "g" in self.format:
                        value = float(value)
                    if "d" in self.format:
                        value = int(float(value))
                    output = u"{[%s]%s}" % (self.key, self.format)
                    value = output.format({self.key: value})
                    value_ = float(value)
                except ValueError:
                    pass
            elif self.format.startswith("!"):
                output = u"{%s%s}" % (self.key, self.format)
                value = value_ = output.format(**{self.key: value})

            if block.commands.not_zero:
                valid = value_ not in ["", None, False, "0", "0.0", 0, 0.0]
            else:
                # '', None, and False are ignored
                # numbers like 0 and 0.0 are not.
                valid = not (value_ in ["", None] or value_ is False)
            enough = False
        except:  # noqa e722
            # Exception raised when we don't have the param
            enough = True
            valid = False

        return valid, value, enough
1193446
private static Message generateHeader(HeaderValues param) {

        HeaderFields header = new HeaderFields();
        setValues(header, param);

        Message headerMsg = header.unwrap();

        for (String comment : param.comments) {
            headerMsg.addComment(comment);
        }

        return headerMsg;
    }
992331
def format_headers
      @headers.stringify_keys.each_with_object({}) do |key_with_value, headers|
        headers[format_key(key_with_value.first)] = key_with_value.last
      end
    end
1149294
def _format_param_val(self, param_val):
        
        if isinstance(param_val, list):
            return ' '.join(str(x) for x in param_val)
        else:
            return str(param_val)
934882
def parametrize(params):
    
    returned = str(params[0])
    returned += "".join("[" + str(p) + "]" for p in params[1:])
    return returned
179184
protected void parseParams(Map<String, String> params) {
        generateAlgorithm = indexOf(PARAM_ALGORITHM, DEFAULT_ALGORITHM, SUPPORTED_ALGORITHMS, params.get(PARAM_ALGORITHM));
        generateIterations = parseInt(PARAM_ITERATIONS, params.get(PARAM_ITERATIONS), DEFAULT_ITERATIONS, MINIMUM_ITERATIONS);
        generateSaltSize = parseInt(PARAM_SALTSIZE, params.get(PARAM_SALTSIZE), DEFAULT_SALTSIZE, MINIMUM_SALTSIZE);
        generateKeySize = parseInt(PARAM_KEYSIZE, params.get(PARAM_KEYSIZE), DEFAULT_KEYSIZE, MINIMUM_KEYSIZE);
    }
746268
function convertParameters(parameters) {
  return parameters.map(parameter => {
    const { required, name } = parameter;
    return {
      name,
      disabled: required !== true,
      value: `${generateParameterExample(parameter)}`,
    };
  });
}
309828
def parse_http_header(header_line):
    

    header_line = header_line.decode().strip()
    col_idx = header_line.find(':')

    if col_idx < 1:
        raise BadHttpHeaderError('Bad header: {}'.format(repr(header_line)))

    key = header_line[0:col_idx].strip()
    value = header_line[(col_idx+1):].strip()
    return HttpHeader(key=key, value=value)
567598
def prepare_params(req: snug.Request) -> snug.Request:
    """"""
    return req.replace(
        params={key: dump_param(val) for key, val in req.params.items()
                if val is not None})
20168
def prepare_params(request):
    """"""
    return request.replace(
        params={key: dump_param(val) for key, val in request.params.items()
                if val is not None})
196085
function(params) {
			var newparams = ''; 
			
			for (par in params) {
				var obj = params[par];
				if(typeof obj ==  'string'){
					if (params[par]) {
						if(newparams)newparams += "&";
						newparams += par + "=" + params[par];
					}
				}else if(obj instanceof  Array){
					if(newparams)newparams += "&";
					
					var i = 0;
					for(i=0; i<obj.length; i++){
						if (obj[i]) {
							newparams += par + "=" + obj[i];
							if(i != obj.length-1)newparams += ";";
						}
						
					}
				}
			}
			//newparams=newparams.encode();
			//encode(newparams);
			//return escape('?'+newparams);
			return encodeURI('?'+newparams); //The old version (escape('?'+newparams);) gave problems because it encoded ? and &
		}