mirror of https://github.com/vapor/docs.git
Routing, Query Parameters - Code indentation fix.
This commit is contained in:
parent
6bd047772e
commit
75e3bd6f07
|
|
@ -12,10 +12,10 @@ Optional syntax is the easiest way to handle optional query parameters.
|
|||
|
||||
```swift
|
||||
drop.get("comments") { request in
|
||||
if let rating = request.query?["rating"]?.int {
|
||||
return "You requested comments with rating greater than #\(rating)"
|
||||
}
|
||||
return "You requested all comments"
|
||||
if let rating = request.query?["rating"]?.int {
|
||||
return "You requested comments with rating greater than #\(rating)"
|
||||
}
|
||||
return "You requested all comments"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -26,9 +26,9 @@ To use this syntax first we need to ensure the query object is present with a `g
|
|||
|
||||
```swift
|
||||
drop.get("comments") { request in
|
||||
guard let rating = request.query?["rating"]?.int else {
|
||||
throw Abort.custom(status: .preconditionFailed, message: "Please include a rating")
|
||||
}
|
||||
return "You requested comments with rating greater than #\(rating)"
|
||||
guard let rating = request.query?["rating"]?.int else {
|
||||
throw Abort.custom(status: .preconditionFailed, message: "Please include a rating")
|
||||
}
|
||||
return "You requested comments with rating greater than #\(rating)"
|
||||
}
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in New Issue