-
Notifications
You must be signed in to change notification settings - Fork 8
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
Query parameters #7
Comments
I think this would be a part of https://github.com/nestproject/Inquiline, but it appears that it isn't in fact accounted for. I opened this: nestproject/Inquiline#13 |
Here, throw this is somewhere if you're looking for a quick fix for this. import Nest extension RequestType {
} You can now use |
My solution to adding query parameters include:
var query: [String: String] { get }
// Top of file
import Foundation
// Property with path, body, content... etc
public var query = [String: String]()
// Inside the initializer
self.getQueries()
// Request function definition
mutating func getQueries() {
let splitPath = self.path.components(separatedBy: "?")
self.path = splitPath[0]
guard splitPath.count > 1 else {
return
}
let queries = splitPath[1].components(separatedBy: "&")
for splitQuery in queries {
let query = splitQuery.components(separatedBy: "=")
guard query.count == 2 else {
continue
}
self.query[query[0]] = query[1]
}
} This solution removes the query from the path, and is accessible via: |
Am I understanding it correctly that Frank doesn't include the notion of query parameters for routes? They're not part of Nest are they?
The text was updated successfully, but these errors were encountered: