 @testable import Kitura
 @testable import KituraNet
 
+let cookie1Name = "KituraTest1"
+let cookie1Value = "Testing-Testing-1-2-3"
+let cookie2Name = "KituraTest2"
+let cookie2Value = "Testing-Testing"
+let cookie2ExpireExpected = NSDate(timeIntervalSinceNow: 600.0)
+let cookie3Name = "KituraTest3"
+let cookie3Value = "A-testing-we-go"
+
+let cookieHost = "localhost"
+
 class TestCookies : KituraTest {
     #if os(Linux)
         override var allTests : [(String, () throws -> Void)] {
             return [
-                ("testCookieToServer", testCookieToServer)
+                ("testCookieToServer", testCookieToServer),
+                ("testCookieFromServer", testCookieFromServer)
             ]
         }
     #endif

        })
    }

    static func setupRouter() -> Router {
        let router = Router()


            next()
        }

        router.get("/1/sendcookie") {request, response, next in
            response.status(HttpStatusCode.OK)

            let cookie1 = NSHTTPCookie(properties: [NSHTTPCookieName: cookie1Name,
                                                NSHTTPCookieValue: cookie1Value,
                                                NSHTTPCookieDomain: cookieHost,
                                                NSHTTPCookiePath: "/"])
            response.cookies[cookie1!.name] = cookie1
            let cookie2 = NSHTTPCookie(properties: [NSHTTPCookieName: cookie2Name,
                                                NSHTTPCookieValue: cookie2Value,
                                                NSHTTPCookieDomain: cookieHost,
                                                NSHTTPCookiePath: "/",
                                                NSHTTPCookieExpires: cookie2ExpireExpected])
            response.cookies[cookie2!.name] = cookie2

            next()
        }

        router.get("/2/sendcookie") {request, response, next in
            response.status(HttpStatusCode.OK)

            let cookie = NSHTTPCookie(properties: [NSHTTPCookieName: cookie3Name,
                                                NSHTTPCookieValue: cookie3Value,
                                                NSHTTPCookieDomain: cookieHost,
                                                NSHTTPCookiePath: "/",
                                                NSHTTPCookieSecure: "Yes"])
            response.cookies[cookie!.name] = cookie

            next()
        }

        return router
    }
}
