Skip to content

Commit a55b4d9

Browse files
committed
refactor: use shared http client for delete req
1 parent fe3f0f6 commit a55b4d9

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
structDeleteJSON{
88
staticfunc main()asyncthrows{
9-
lethttpClient=HTTPClient(eventLoopGroupProvider:.singleton)
9+
lethttpClient=HTTPClient.shared
1010

1111
do{
1212
varrequest=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-
tryawait httpClient.shutdown()
2220
}
2321
}

0 commit comments

Comments
(0)