Skip to content

Commit ab74291

Browse files
author
Clément Le Provost
committed
Add auxiliary method to build a query string
This was previously embedded in the `AbstractQuery.build()` instance method.
1 parent 636aedb commit ab74291

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Source/AbstractQuery.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,12 @@ open class AbstractQuery : NSObject, NSCopying {
251251
// MARK: Serialization & parsing
252252

253253
/// Return the final query string used in URL.
254-
@objc public func build() -> String {
254+
@objc open func build() -> String {
255+
return AbstractQuery.build(parameters: parameters)
256+
}
257+
258+
/// Build a query string from a set of parameters.
259+
@objc static public func build(parameters: [String: String]) -> String {
255260
var components = [String]()
256261
// Sort parameters by name to get predictable output.
257262
let sortedParameters = parameters.sorted { $0.0 < $1.0 }

0 commit comments

Comments
 (0)