Open
Description
I think it'd be useful to have a matcher (or change uri
) to compare query parameters ignoring their order. I was able to implement that with a custom matcher:
func uriWithQuery(uriString:String) -> (request:NSURLRequest) -> Bool {
return { (request:NSURLRequest) in
if uri(uriString)(request: request) {
return true
}
if let components = NSURLComponents(string: uriString),
requestComponents = request.URL.flatMap({ NSURLComponents.init(URL: $0, resolvingAgainstBaseURL: false)}) {
let componentsWithoutParams = components.copy() as! NSURLComponents
componentsWithoutParams.query = nil
let requestComponentsWithoutParams = requestComponents.copy() as! NSURLComponents
requestComponentsWithoutParams.query = nil
if requestComponentsWithoutParams.URL == componentsWithoutParams.URL {
return requestComponents.queryItems.flatMap(Set.init) == components.queryItems.flatMap(Set.init)
}
}
return false
}
}
Note that this probably doesn't support path templates.
Metadata
Metadata
Assignees
Labels
No labels