You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/AsyncHTTPClient/Docs.docc/index.md
+15-13
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
This package provides simple HTTP Client library built on top of SwiftNIO.
4
4
5
+
## Overview
6
+
5
7
This library provides the following:
6
8
- First class support for Swift Concurrency (since version 1.9.0)
7
9
- Asynchronous and non-blocking request methods
@@ -17,7 +19,7 @@ This library provides the following:
17
19
18
20
---
19
21
20
-
## Getting Started
22
+
###Getting Started
21
23
22
24
#### Adding the dependency
23
25
@@ -71,13 +73,13 @@ httpClient.get(url: "https://apple.com/").whenComplete { result in
71
73
}
72
74
```
73
75
74
-
You should always shut down ``HTTPClient`` instances you created using ``HTTPClient/shutdown()-96ayw()``. Please note that you must not call ``HTTPClient/shutdown()-96ayw()`` before all requests of the HTTP client have finished, or else the in-flight requests will likely fail because their network connections are interrupted.
76
+
You should always shut down ``HTTPClient`` instances you created using ``HTTPClient/shutdown()-9gcpw``. Please note that you must not call ``HTTPClient/shutdown()-9gcpw`` before all requests of the HTTP client have finished, or else the in-flight requests will likely fail because their network connections are interrupted.
75
77
76
-
### async/await examples
78
+
####async/await examples
77
79
78
80
Examples for the async/await API can be found in the [`Examples` folder](https://github.com/swift-server/async-http-client/tree/main/Examples) in the repository.
79
81
80
-
## Usage guide
82
+
###Usage guide
81
83
82
84
The default HTTP Method is `GET`. In case you need to have more control over the method, or you want to add headers or body, use the ``HTTPClientRequest`` struct:
83
85
@@ -134,14 +136,14 @@ httpClient.execute(request: request).whenComplete { result in
134
136
}
135
137
```
136
138
137
-
### Redirects following
139
+
####Redirects following
138
140
Enable follow-redirects behavior using the client configuration:
139
141
```swift
140
142
let httpClient =HTTPClient(eventLoopGroupProvider: .createNew,
Connecting to servers bound to socket paths is easy:
285
287
```swift
286
288
let httpClient =HTTPClient(eventLoopGroupProvider: .createNew)
@@ -314,7 +316,7 @@ let secureSocketPathBasedURL = URL(
314
316
)
315
317
```
316
318
317
-
### Disabling HTTP/2
319
+
####Disabling HTTP/2
318
320
The exclusive use of HTTP/1 is possible by setting ``HTTPClient/Configuration/httpVersion-swift.property`` to ``HTTPClient/Configuration/HTTPVersion-swift.struct/http1Only`` on the ``HTTPClient/Configuration``:
319
321
```swift
320
322
var configuration = HTTPClient.Configuration()
@@ -325,7 +327,7 @@ let client = HTTPClient(
325
327
)
326
328
```
327
329
328
-
## Security
330
+
###Security
329
331
330
332
AsyncHTTPClient's security process is documented on [GitHub](https://github.com/swift-server/async-http-client/blob/main/SECURITY.md).
0 commit comments