diff --git a/Test/Flurl.Test/UrlBuilder/UrlParsingTests.cs b/Test/Flurl.Test/UrlBuilder/UrlParsingTests.cs index 2c15686..95bb0ef 100644 --- a/Test/Flurl.Test/UrlBuilder/UrlParsingTests.cs +++ b/Test/Flurl.Test/UrlBuilder/UrlParsingTests.cs @@ -115,5 +115,13 @@ namespace Flurl.Test.UrlBuilder var url = new Url(expected); Assert.AreEqual(expected, url.ToString()); } + + [Test] // #656 + public void queryparams_uses_equals() { + var url = new Url("http://www.mysite.com?param=1"); + // String gets boxed, so we need to use Equals, instead of == + var contains = url.QueryParams.Contains("param", "1"); + Assert.IsTrue(contains); + } } } diff --git a/src/Flurl/QueryParamCollection.cs b/src/Flurl/QueryParamCollection.cs index 5ce2736..0cae617 100644 --- a/src/Flurl/QueryParamCollection.cs +++ b/src/Flurl/QueryParamCollection.cs @@ -161,7 +161,7 @@ namespace Flurl public bool Contains(string name) => _values.Contains(name); /// > - public bool Contains(string name, object value) => _values.Any(qv => qv.Name == name && qv.Value.Value == value); + public bool Contains(string name, object value) => _values.Any(qv => qv.Name == name && qv.Value.Value.Equals(value)); } ///