Created
March 19, 2019 23:26
-
-
Save hishma/8e3e951561a7cce2ec12d9c3d2ee2746 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension URL { | |
public mutating func deleteQuery() { | |
self = self.deletingQuery() | |
} | |
public func deletingQuery() -> URL { | |
guard var components = URLComponents(url: self, resolvingAgainstBaseURL: false) else { return self } | |
components.query = nil | |
return components.url ?? self | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment