Skip to content

Commit e3e7f31

Browse files
committed
refactor: use shared http client for delete req
1 parent 90ca4d7 commit e3e7f31

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Examples/DeleteJSON/DeleteJSON.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import NIOFoundationCompat
66
@main
77
struct DeleteJSON {
88
static func main() async throws {
9-
let httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
9+
let httpClient = HTTPClient.shared
1010

1111
do {
1212
var request = HTTPClientRequest(url: "http://localhost:8080/todos/1)")
@@ -17,7 +17,5 @@ struct DeleteJSON {
1717
} catch {
1818
print("request failed:", error)
1919
}
20-
// it is important to shutdown the httpClient after all requests are done, even if one failed
21-
try await httpClient.shutdown()
2220
}
2321
}

0 commit comments

Comments
 (0)