Skip to content

Commit 73c400f

Browse files
committed
drop version
1 parent 50fd77d commit 73c400f

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

Sources/AsyncHTTPClient/HTTPHandler.swift

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ extension HTTPClient {
8888

8989
/// Represent HTTP request.
9090
public struct Request {
91-
/// Request HTTP version, defaults to `HTTP/1.1`.
92-
public let version: HTTPVersion
9391
/// Request HTTP method, defaults to `GET`.
9492
public let method: HTTPMethod
9593
/// Remote URL.
@@ -116,12 +114,12 @@ extension HTTPClient {
116114
/// - `emptyScheme` if URL does not contain HTTP scheme.
117115
/// - `unsupportedScheme` if URL does contains unsupported HTTP scheme.
118116
/// - `emptyHost` if URL does not contains a host.
119-
public init(url: String, version: HTTPVersion = HTTPVersion(major: 1, minor: 1), method: HTTPMethod = .GET, headers: HTTPHeaders = HTTPHeaders(), body: Body? = nil) throws {
117+
public init(url: String, method: HTTPMethod = .GET, headers: HTTPHeaders = HTTPHeaders(), body: Body? = nil) throws {
120118
guard let url = URL(string: url) else {
121119
throw HTTPClientError.invalidURL
122120
}
123121

124-
try self.init(url: url, version: version, method: method, headers: headers, body: body)
122+
try self.init(url: url, method: method, headers: headers, body: body)
125123
}
126124

127125
/// Create an HTTP `Request`.
@@ -136,7 +134,7 @@ extension HTTPClient {
136134
/// - `emptyScheme` if URL does not contain HTTP scheme.
137135
/// - `unsupportedScheme` if URL does contains unsupported HTTP scheme.
138136
/// - `emptyHost` if URL does not contains a host.
139-
public init(url: URL, version: HTTPVersion = HTTPVersion(major: 1, minor: 1), method: HTTPMethod = .GET, headers: HTTPHeaders = HTTPHeaders(), body: Body? = nil) throws {
137+
public init(url: URL, method: HTTPMethod = .GET, headers: HTTPHeaders = HTTPHeaders(), body: Body? = nil) throws {
140138
guard let scheme = url.scheme?.lowercased() else {
141139
throw HTTPClientError.emptyScheme
142140
}
@@ -149,7 +147,6 @@ extension HTTPClient {
149147
throw HTTPClientError.emptyHost
150148
}
151149

152-
self.version = version
153150
self.method = method
154151
self.url = url
155152
self.scheme = scheme
@@ -445,10 +442,10 @@ internal class TaskHandler<T: HTTPClientResponseDelegate>: ChannelInboundHandler
445442
self.state = .idle
446443
let request = unwrapOutboundIn(data)
447444

448-
var head = HTTPRequestHead(version: request.version, method: request.method, uri: request.url.uri)
445+
var head = HTTPRequestHead(version: HTTPVersion(major: 1, minor: 1), method: request.method, uri: request.url.uri)
449446
var headers = request.headers
450447

451-
if request.version.major == 1, request.version.minor == 1, !request.headers.contains(name: "Host") {
448+
if !request.headers.contains(name: "Host") {
452449
headers.add(name: "Host", value: request.host)
453450
}
454451

@@ -677,7 +674,7 @@ internal struct RedirectHandler<T> {
677674
}
678675

679676
do {
680-
let newRequest = try HTTPClient.Request(url: redirectURL, version: originalRequest.version, method: method, headers: headers, body: body)
677+
let newRequest = try HTTPClient.Request(url: redirectURL, method: method, headers: headers, body: body)
681678
return self.execute(newRequest).futureResult.cascade(to: promise)
682679
} catch {
683680
return promise.fail(error)

0 commit comments

Comments
 (0)