Merge pull request #657 from wrexbe/656-fix-queryparams-contains
#656 QueryParams contains bug
This commit is contained in:
commit
27d350ecdf
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ namespace Flurl
|
||||
public bool Contains(string name) => _values.Contains(name);
|
||||
|
||||
/// <inheritdoc />>
|
||||
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));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user