Skip to content

Commit 9be0315

Browse files
authored
review fixes
1 parent 3785391 commit 9be0315

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Diff for: README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# swift-nio-http-client
1+
# SwiftNIOHTTPClient
22
This package provides simple HTTP Client library built on top of SwiftNIO.
33

44
This library provides the following:
@@ -10,7 +10,7 @@ This library provides the following:
1010

1111
---
1212

13-
**NOTE**: You will need [Xcode 10.2](https://itunes.apple.com/us/app/xcode/id497799835) or [Swift 5.0](https://swift.org/download/#swift-50) to try out `swift-nio-htt-client`.
13+
**NOTE**: You will need [Xcode 10.2](https://itunes.apple.com/us/app/xcode/id497799835) or [Swift 5.0](https://swift.org/download/#swift-50) to try out `SwiftNIOHTTPClient`.
1414

1515
---
1616

@@ -25,7 +25,7 @@ Add the following entry in your <code>Package.swift</code> to start using <code>
2525
```
2626
and ```SwiftNIOHTTP``` dependency to your target:
2727
```swift
28-
.target(name: "MyApp", dependencies: ["SwiftNIOHTTP"]),
28+
.target(name: "MyApp", dependencies: ["NIOHTTPClient"]),
2929
```
3030

3131
#### Request-Response API
@@ -105,11 +105,11 @@ let httpClient = HTTPClient(eventLoopGroupProvider: .createNew,
105105
or on per-request basis:
106106
```swift
107107
let timeout = Timeout(connectTimeout: .seconds(1), readTimeout: .seconds(1))
108-
let response = try httpClient.execute(request: request, timeout: timeout).wait()
108+
httpClient.execute(request: request, timeout: timeout)
109109
```
110110

111111
### Streaming
112-
When dealing with larger amount of data, it's critical to steam the response body instead of aggregating it-memory. Handling a response stream is done using a delegate protocol. The following example demonstrates how to count the number of bytes in a streaming response body:
112+
When dealing with larger amount of data, it's critical to stream the response body instead of aggregating in-memory. Handling a response stream is done using a delegate protocol. The following example demonstrates how to count the number of bytes in a streaming response body:
113113
```swift
114114
class CountingDelegate: HTTPResponseDelegate {
115115
typealias Response = Int
@@ -142,5 +142,7 @@ class CountingDelegate: HTTPResponseDelegate {
142142
let request = try HTTPRequest(url: "https://swift.org")
143143
let delegate = CountingDelegate()
144144

145-
let count = try httpClient.execute(request: request, delegate: delegate).wait()
145+
try httpClient.execute(request: request, delegate: delegate).future.whenSuccess { count in
146+
print(count)
147+
}
146148
```

0 commit comments

Comments
 (0)