Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tospery
Copy link

@tospery tospery commented Apr 27, 2024

  1. Add replaceExisting to appendingQueryParameters/appendQueryParameters.
  2. 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)
Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 130 to 133
///
/// var url = URL(string: "https://domain.com?query=true")!
/// url.deleteAllQueryParameters()
/// print(url) // prints "https://domain.com"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
///
/// 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"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants