This repository was archived by the owner on Apr 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +30
-14
lines changed Expand file tree Collapse file tree 5 files changed +30
-14
lines changed Original file line number Diff line number Diff line change
1
+ jobs :
2
+ build :
3
+ docker :
4
+ - image : buildpack-deps:trusty
5
+ steps :
6
+ - checkout
7
+ - run :
8
+ name : Install Swift
9
+ command : ' eval "$(curl -sL https://apt.vapor.sh)"'
10
+ - run :
11
+ name : Install Vapor toolbox
12
+ command : |
13
+ sudo apt-get install --yes vapor
14
+ sudo apt-get install --yes cmysql
15
+ sudo chmod -R a+rx /usr/
16
+ - run :
17
+ name : Run Tests
18
+ command : |
19
+ swift test -Xswiftc -DNOJSON
Original file line number Diff line number Diff line change @@ -9,12 +9,15 @@ before_install:
9
9
brew tap vapor/tap;
10
10
brew update;
11
11
brew install vapor;
12
+ brew install cmysql;
13
+ gem install xcpretty;
12
14
13
15
script :
16
+ - set -o pipefail
14
17
- swift build
15
18
- swift build -c release
16
19
- swift package generate-xcodeproj --enable-code-coverage
17
- - xcodebuild -scheme Gatekeeper -enableCodeCoverage YES test
20
+ - xcodebuild -scheme Gatekeeper -enableCodeCoverage YES test | xcpretty
18
21
19
22
after_success :
20
23
- bash <(curl -s https://codecov.io/bash)
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ public struct RateLimiter: Middleware {
46
46
}
47
47
48
48
public func respond( to request: Request , chainingTo next: Responder ) throws -> Response {
49
- guard let peer = request. peerAddress ? . address ( ) else {
49
+ guard let peer = request. peerHostname else {
50
50
throw Abort (
51
51
. forbidden,
52
52
metadata: nil ,
Original file line number Diff line number Diff line change @@ -158,14 +158,18 @@ extension GatekeeperTests {
158
158
}
159
159
160
160
func getHTTPRequest( ) -> Request {
161
- return try ! Request ( method: . get, uri: " http://localhost:8080/ " )
161
+ return Request ( method: . get, uri: " http://localhost:8080/ " )
162
162
}
163
163
164
164
func getHTTPSRequest( ) -> Request {
165
+
166
+ var headers = [ HeaderKey: String] ( )
167
+ headers [ " X-Forwarded-For " ] = " 192.168.1.2 "
168
+
165
169
return try ! Request (
166
170
method: . get,
167
171
uri: URI ( " https://localhost:8080/ " ) ,
168
- peerAddress : PeerAddress ( stream : " 192.168.1.2 " )
172
+ headers : headers
169
173
)
170
174
}
171
175
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments