Skip to content

Commit c927b74

Browse files
committed
Formatting
1 parent c6e6ef0 commit c927b74

File tree

4 files changed

+11
-22
lines changed

4 files changed

+11
-22
lines changed

Sources/Example/Example.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ struct Example {
1616
@concurrent
1717
static func serve() async throws {
1818
InstrumentationSystem.bootstrap(LogTracer())
19-
let logger = Logger(label: "Logger")
19+
var logger = Logger(label: "Logger")
20+
logger.logLevel = .trace
2021

2122
// Using the new extension method that doesn't require type hints
2223
let privateKey = P256.Signing.PrivateKey()

Sources/Example/Middlewares/HTTPRequestLoggingMiddleware.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ where
5050
logger: self.logger
5151
)
5252
try await next(
53-
(
54-
request, wrappedReader,
55-
{ httpResponse in
53+
(request, wrappedReader, { httpResponse in
5654
let writer = try await respond(httpResponse)
5755
return HTTPResponseLoggingConcludingAsyncWriter(
5856
base: writer,

Sources/HTTPServer/HTTPServer.swift

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,8 @@ public final class Server<RequestHandler: HTTPServerRequestHandler> {
155155
configuration: HTTPServerConfiguration,
156156
handler: RequestHandler
157157
) async throws {
158-
let serverChannel = try await Self.bind(
159-
bindTarget: configuration.bindTarget
160-
) {
161-
(
162-
channel
163-
) -> EventLoopFuture<
158+
let serverChannel = try await Self.bind(bindTarget: configuration.bindTarget) {
159+
(channel) -> EventLoopFuture<
164160
EventLoopFuture<
165161
NIONegotiatedHTTPVersion<
166162
NIOAsyncChannel<HTTPRequestPart, HTTPResponsePart>,
@@ -175,10 +171,8 @@ public final class Server<RequestHandler: HTTPServerRequestHandler> {
175171
switch configuration.tlSConfiguration.backing {
176172
case .insecure:
177173
break
178-
case .certificateChainAndPrivateKey(
179-
let certificateChain,
180-
let privateKey
181-
):
174+
175+
case .certificateChainAndPrivateKey(let certificateChain, let privateKey):
182176
let certificateChain =
183177
try certificateChain
184178
.map {
@@ -264,12 +258,12 @@ public final class Server<RequestHandler: HTTPServerRequestHandler> {
264258
}
265259
}
266260
} catch {
267-
logger.debug("HTTP2 connection closed")
261+
logger.debug("HTTP2 connection closed: \(error)")
268262
}
269263
}
270264
}
271265
} catch {
272-
logger.debug("Negotiating ALPN failed")
266+
logger.debug("Negotiating ALPN failed: \(error)")
273267
}
274268
}
275269
}

Sources/HTTPServer/HTTPServerClosureRequestHandler.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ public struct HTTPServerClosureRequestHandler: HTTPServerRequestHandler {
4040
handler: @Sendable @escaping (
4141
HTTPRequest,
4242
consuming HTTPRequestConcludingAsyncReader,
43-
@escaping (
44-
HTTPResponse
45-
) async throws -> HTTPResponseConcludingAsyncWriter
43+
@escaping (HTTPResponse) async throws -> HTTPResponseConcludingAsyncWriter
4644
) async throws -> Void
4745
) {
4846
self._handler = handler
@@ -59,9 +57,7 @@ public struct HTTPServerClosureRequestHandler: HTTPServerRequestHandler {
5957
public func handle(
6058
request: HTTPRequest,
6159
requestConcludingAsyncReader: HTTPRequestConcludingAsyncReader,
62-
sendResponse: @escaping (
63-
HTTPResponse
64-
) async throws -> HTTPResponseConcludingAsyncWriter
60+
sendResponse: @escaping (HTTPResponse) async throws -> HTTPResponseConcludingAsyncWriter
6561
) async throws {
6662
try await self._handler(request, requestConcludingAsyncReader, sendResponse)
6763
}

0 commit comments

Comments
 (0)