Skip to content

Commit 1d7c9af

Browse files
authored
Merge branch 'master' into request-fixes
2 parents 34b718c + bab22d0 commit 1d7c9af

File tree

6 files changed

+33
-13
lines changed

6 files changed

+33
-13
lines changed

.swiftformat

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# file options
22

3+
--exclude .build
4+
35
# format options
46

5-
--self insert
6-
--patternlet inline
7-
--stripunusedargs unnamed-only
7+
--self insert
8+
--patternlet inline
9+
--stripunusedargs unnamed-only
810
--comments ignore
911

1012
# rules

Sources/AsyncHTTPClient/HTTPHandler.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import NIOHTTP1
1919
import NIOSSL
2020

2121
extension HTTPClient {
22-
2322
/// Represent request body.
2423
public struct Body {
2524
/// Chunk provider.
@@ -330,7 +329,7 @@ extension HTTPClientResponseDelegate {
330329

331330
public func didSendRequest(task: HTTPClient.Task<Response>) {}
332331

333-
public func didReceiveHead(task: HTTPClient.Task<Response>, _: HTTPResponseHead) -> EventLoopFuture<Void> { return task.eventLoop.makeSucceededFuture(()) }
332+
public func didReceiveHead(task: HTTPClient.Task<Response>, _: HTTPResponseHead) -> EventLoopFuture<Void> { return task.eventLoop.makeSucceededFuture(()) }
334333

335334
public func didReceivePart(task: HTTPClient.Task<Response>, _: ByteBuffer) -> EventLoopFuture<Void> { return task.eventLoop.makeSucceededFuture(()) }
336335

Tests/AsyncHTTPClientTests/HTTPClientInternalTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,3 @@ class HTTPClientInternalTests: XCTestCase {
194194
XCTAssertEqual(delegate.reads, 3)
195195
}
196196
}
197-

Tests/AsyncHTTPClientTests/HTTPClientTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class HTTPClientTests: XCTestCase {
6060
let response = try httpClient.get(url: "http://localhost:\(httpBin.port)/get").wait()
6161
XCTAssertEqual(.ok, response.status)
6262
}
63-
63+
6464
func testGetWithSharedEventLoopGroup() throws {
6565
let httpBin = HttpBin()
6666
let elg = MultiThreadedEventLoopGroup(numberOfThreads: 8)
@@ -69,12 +69,12 @@ class HTTPClientTests: XCTestCase {
6969
try! elg.syncShutdownGracefully()
7070
httpBin.shutdown()
7171
}
72-
72+
7373
let delegate = TestHTTPDelegate()
7474
let request = try HTTPClient.Request(url: "http://localhost:\(httpBin.port)/events/10/1")
7575
let task = httpClient.execute(request: request, delegate: delegate)
7676
let expectedEventLoop = task.eventLoop
77-
task.futureResult.whenComplete { (_) in
77+
task.futureResult.whenComplete { _ in
7878
XCTAssertTrue(expectedEventLoop.inEventLoop)
7979
}
8080
try task.wait()
@@ -170,15 +170,15 @@ class HTTPClientTests: XCTestCase {
170170
let hostName = try decoder.decode([String: String].self, from: responseData)["data"]
171171
XCTAssert(hostName == "127.0.0.1")
172172
}
173-
173+
174174
func testPercentEncoded() throws {
175175
let httpBin = HttpBin()
176176
let httpClient = HTTPClient(eventLoopGroupProvider: .createNew)
177177
defer {
178178
try! httpClient.syncShutdown()
179179
httpBin.shutdown()
180180
}
181-
181+
182182
let response = try httpClient.get(url: "http://localhost:\(httpBin.port)/percent%20encoded").wait()
183183
XCTAssertEqual(.ok, response.status)
184184
}

docker/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ RUN gem install jazzy --no-ri --no-rdoc
2323
RUN mkdir -p $HOME/.tools
2424
RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile
2525

26-
# script to allow mapping framepointers on linux
26+
# script to allow mapping framepointers on linux (until part of the toolchain)
2727
RUN wget -q https://raw.githubusercontent.com/apple/swift/master/utils/symbolicate-linux-fatal -O $HOME/.tools/symbolicate-linux-fatal
2828
RUN chmod 755 $HOME/.tools/symbolicate-linux-fatal
29+
30+
# swiftformat (until part of the toolchain)
31+
32+
ARG swiftformat_version=0.40.11
33+
RUN git clone --branch $swiftformat_version --depth 1 https://github.com/nicklockwood/SwiftFormat $HOME/.tools/swift-format
34+
RUN cd $HOME/.tools/swift-format && swift build -c release
35+
RUN ln -s $HOME/.tools/swift-format/.build/release/swiftformat $HOME/.tools/swiftformat

scripts/sanity.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,23 @@ else
2828
printf "\033[0;32mokay.\033[0m\n"
2929
fi
3030

31-
printf "=> Checking license headers... "
31+
printf "=> Checking format... "
32+
FIRST_OUT="$(git status --porcelain)"
33+
swiftformat . > /dev/null 2>&1
34+
SECOND_OUT="$(git status --porcelain)"
35+
if [[ "$FIRST_OUT" != "$SECOND_OUT" ]]; then
36+
printf "\033[0;31mformatting issues!\033[0m\n"
37+
git --no-pager diff
38+
exit 1
39+
else
40+
printf "\033[0;32mokay.\033[0m\n"
41+
fi
42+
43+
printf "=> Checking license headers\n"
3244
tmp=$(mktemp /tmp/.async-http-client-sanity_XXXXXX)
3345

3446
for language in swift-or-c bash dtrace; do
47+
printf " * $language... "
3548
declare -a matching_files
3649
declare -a exceptions
3750
expections=( )

0 commit comments

Comments
 (0)