Esempio n. 1
0
        private void BuildDictionaryValue(StringBuilder builder, VarSpec varSpec, IDictionary <string, string> values)
        {
            var first = true;

            CheckCompositeVariables(varSpec);

            if (op.Named && !varSpec.Exploded)
            {
                builder.Append(varSpec.Name);
                builder.Append('=');
            }

            foreach (var item in values)
            {
                if (!first)
                {
                    builder.Append(varSpec.Exploded ? op.Separator : ",");
                }

                var key = PctEncoding.Escape(item.Key, CharSpec.ExtendedSafe);

                builder.Append(key);
                builder.Append(varSpec.Exploded ? '=' : ',');
                BuildValue(builder, varSpec, item.Value ?? string.Empty);

                first = false;
            }
        }
Esempio n. 2
0
        private void BuildValue(StringBuilder builder, VarSpec varSpec, string value)
        {
            var charSpec = op.AllowReserved ? CharSpec.ExtendedSafe : CharSpec.Safe;

            value = PctEncoding.Escape(value, charSpec);
            builder.Append(value);
        }
Esempio n. 3
0
 public static string Unescape(string name)
 {
     return(PctEncoding.Unescape(name, CharSpec.VarChar));
 }