mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Set query to None when no search params
This commit is contained in:
parent
2e15cf0f81
commit
ae965d6d8d
3 changed files with 9 additions and 26 deletions
|
@ -57,10 +57,15 @@ impl URL {
|
||||||
|
|
||||||
pub fn set_query_pairs(&self, pairs: &[(String, String)]) {
|
pub fn set_query_pairs(&self, pairs: &[(String, String)]) {
|
||||||
let mut url = self.url.borrow_mut();
|
let mut url = self.url.borrow_mut();
|
||||||
url.as_mut_url()
|
|
||||||
.query_pairs_mut()
|
if pairs.is_empty() {
|
||||||
.clear()
|
url.as_mut_url().set_query(None);
|
||||||
.extend_pairs(pairs);
|
} else {
|
||||||
|
url.as_mut_url()
|
||||||
|
.query_pairs_mut()
|
||||||
|
.clear()
|
||||||
|
.extend_pairs(pairs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
[urlsearchparams-delete.any.worker.html]
|
|
||||||
[Removing non-existent param removes ? from URL]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Deleting all params removes ? from URL]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
|
|
||||||
[urlsearchparams-delete.any.html]
|
|
||||||
[Removing non-existent param removes ? from URL]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Deleting all params removes ? from URL]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
[urlsearchparams-sort.any.html]
|
|
||||||
[Sorting non-existent params removes ? from URL]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[urlsearchparams-sort.any.worker.html]
|
|
||||||
[Sorting non-existent params removes ? from URL]
|
|
||||||
expected: FAIL
|
|
Loading…
Add table
Add a link
Reference in a new issue