mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #22666 - CYBAI:urlsearchparams-no-trailing-q, r=nox
Remove trailing ? when updating URLSearchParams --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #22639 - [x] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22666) <!-- Reviewable:end -->
This commit is contained in:
commit
f2b224d610
3 changed files with 9 additions and 26 deletions
|
@ -57,10 +57,15 @@ impl URL {
|
|||
|
||||
pub fn set_query_pairs(&self, pairs: &[(String, String)]) {
|
||||
let mut url = self.url.borrow_mut();
|
||||
url.as_mut_url()
|
||||
.query_pairs_mut()
|
||||
.clear()
|
||||
.extend_pairs(pairs);
|
||||
|
||||
if pairs.is_empty() {
|
||||
url.as_mut_url().set_query(None);
|
||||
} else {
|
||||
url.as_mut_url()
|
||||
.query_pairs_mut()
|
||||
.clear()
|
||||
.extend_pairs(pairs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue