Skip to content
This repository has been archived by the owner on Jan 20, 2020. It is now read-only.

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kamcma committed Aug 25, 2017
1 parent 91eb982 commit 2462121
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import XCTest

XCTMain([
testCase(VaporXFPMiddlewareTests.allTests)
])
])
19 changes: 9 additions & 10 deletions Tests/XFPMiddlewareTests/XFPMiddlewareTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,33 @@ class XFPMiddlewareTests: XCTestCase {
static var allTests = [
("testXFPMiddleware", testXFPMiddleware)
]

override func setUp() {
Testing.onFail = XCTFail
}

func testXFPMiddleware() throws {
let drop = try Droplet()

let protected = drop.grouped(XFPMiddleware.init())
protected.get { req in

protected.get { _ in
return Response(status: .ok)
}

let httpReq = Request(method: .get, uri: "/")
httpReq.uri.scheme = "http"
httpReq.headers["X-Forwarded-Proto"] = "http"

let httpsReq = Request(method: .get, uri: "/")
httpsReq.uri.scheme = "http"
httpsReq.headers["X-Forwarded-Proto"] = "https"

try drop.testResponse(to: httpReq)
.assertStatus(is: .seeOther)

try drop.testResponse(to: httpsReq)
.assertStatus(is: .ok)



}
}

0 comments on commit 2462121

Please sign in to comment.