Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In C# Code the URL Parameters and their values must be encoded before generating the hash-code #243

Open
GoogleCodeExporter opened this issue Oct 14, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Just copy/paste the code :)

Please change the function:

    /// <summary>
    /// Normalizes the request parameters according to the spec
    /// </summary>
    /// <param name="parameters">The list of parameters already sorted</param>
    /// <returns>a string representing the normalized parameters</returns>
    protected string NormalizeRequestParameters(IList<QueryParameter> parameters)
    {
      StringBuilder sb = new StringBuilder();
      QueryParameter p = null;
      for (int i = 0; i < parameters.Count; i++)
      {
        p = parameters[i];
        sb.AppendFormat("{0}={1}", p.Name, p.Value);

        if (i < parameters.Count - 1)
        {
          sb.Append("&");
        }
      }

      return sb.ToString();
    }

To this one:

    /// <summary>
    /// Normalizes the request parameters according to the spec
    /// </summary>
    /// <param name="parameters">The list of parameters already sorted</param>
    /// <returns>a string representing the normalized parameters</returns>
    protected string NormalizeRequestParameters(IList<QueryParameter> parameters)
    {
      StringBuilder sb = new StringBuilder();
      QueryParameter p = null;
      for (int i = 0; i < parameters.Count; i++)
      {
        p = parameters[i];
        sb.AppendFormat("{0}={1}", UrlEncode(p.Name), UrlEncode(p.Value));

        if (i < parameters.Count - 1)
        {
          sb.Append("&");
        }
      }

      return sb.ToString();
    }

Original issue reported on code.google.com by [email protected] on 17 Dec 2013 at 3:29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant