예제 #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;
            }
        }
예제 #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);
        }
예제 #3
0
 public static string Escape(string name)
 {
     return(PctEncoding.Escape(name, CharSpec.VarChar));
 }