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
replaceExisting to append query parameters and delete all query paramters #1193
base: master
Are you sure you want to change the base?
Conversation
tospery
commented
Apr 27, 2024
- Add replaceExisting to appendingQueryParameters/appendQueryParameters.
- Add deletingAllQueryParameters/deleteAllQueryParameters methods support.
} | ||
|
||
func testAppendQueryParameters() { | ||
url.appendQueryParameters(params) | ||
XCTAssertEqual(url, queryUrl) | ||
let replaceURL = URL(string: "https://www.google.com?q=swift%20swifter")! | ||
replaceURL.appendQueryParameters(params, replaceExisting: true) | ||
XCTAssertEqual(replaceURL, queryUrl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test where there is an additional param added as well, only this q
param makes function seem a no-op.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
/// | ||
/// var url = URL(string: "https://domain.com?query=true")! | ||
/// url.deleteAllQueryParameters() | ||
/// print(url) // prints "https://domain.com" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// | |
/// var url = URL(string: "https://domain.com?query=true")! | |
/// url.deleteAllQueryParameters() | |
/// print(url) // prints "https://domain.com" | |
/// | |
/// var url = URL(string: "https://domain.com?query=true")! | |
/// url.deleteAllQueryParameters() | |
/// print(url) // prints "https://domain.com" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done