Peter Zignego před 9 roky
rodič
revize
0b4fadaca0
3 změnil soubory, kde provedl 8 přidání a 7 odebrání
  1. 1 0
      .gitignore
  2. 6 6
      Sources/Swifter/HttpServer.swift
  3. 1 1
      Sources/Swifter/Scopes.swift

+ 1 - 0
.gitignore

@@ -16,6 +16,7 @@ DerivedData
 *.hmap
 *.ipa
 *.xcuserstate
+*.DS_Store
 
 # CocoaPods
 #

+ 6 - 6
Sources/Swifter/HttpServer.swift

@@ -32,27 +32,27 @@ public class HttpServer: HttpServerIO {
     public var DELETE, UPDATE, HEAD, POST, GET, PUT : MethodRoute
     public var delete, update, head, post, get, put : MethodRoute
     
-    public func get(_ path: String, _ handler: ((HttpRequest) -> HttpResponse)) {
+    public func get(_ path: String, _ handler: @escaping ((HttpRequest) -> HttpResponse)) {
         router.register("GET", path: path, handler: handler)
     }
     
-    public func post(_ path: String, _ handler: ((HttpRequest) -> HttpResponse)) {
+    public func post(_ path: String, _ handler: @escaping ((HttpRequest) -> HttpResponse)) {
         router.register("POST", path: path, handler: handler)
     }
     
-    public func put(_ path: String, _ handler: ((HttpRequest) -> HttpResponse)) {
+    public func put(_ path: String, _ handler: @escaping ((HttpRequest) -> HttpResponse)) {
         router.register("PUT", path: path, handler: handler)
     }
     
-    public func head(_ path: String, _ handler: ((HttpRequest) -> HttpResponse)) {
+    public func head(_ path: String, _ handler: @escaping ((HttpRequest) -> HttpResponse)) {
         router.register("HEAD", path: path, handler: handler)
     }
     
-    public func delete(_ path: String, _ handler: ((HttpRequest) -> HttpResponse)) {
+    public func delete(_ path: String, _ handler: @escaping ((HttpRequest) -> HttpResponse)) {
         router.register("DELETE", path: path, handler: handler)
     }
     
-    public func update(_ path: String, _ handler: ((HttpRequest) -> HttpResponse)) {
+    public func update(_ path: String, _ handler: @escaping ((HttpRequest) -> HttpResponse)) {
         router.register("UPDATE", path: path, handler: handler)
     }
 

+ 1 - 1
Sources/Swifter/Scopes.swift

@@ -11,7 +11,7 @@
     import Foundation
 #endif
 
-public func scopes(_ scope: Closure) -> ((HttpRequest) -> HttpResponse) {
+public func scopes(_ scope: @escaping Closure) -> ((HttpRequest) -> HttpResponse) {
     return { r in
         ScopesBuffer[Process.tid] = ""
         scope()