Skip to content

Commit a6d9e84

Browse files
committed
drop version
1 parent 9c7e8d4 commit a6d9e84

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
@@ -87,8 +87,6 @@ extension HTTPClient {
8787

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

123-
try self.init(url: url, version: version, method: method, headers: headers, body: body)
121+
try self.init(url: url, method: method, headers: headers, body: body)
124122
}
125123

126124
/// Create an HTTP `Request`.
@@ -135,7 +133,7 @@ extension HTTPClient {
135133
/// - `emptyScheme` if URL does not contain HTTP scheme.
136134
/// - `unsupportedScheme` if URL does contains unsupported HTTP scheme.
137135
/// - `emptyHost` if URL does not contains a host.
138-
public init(url: URL, version: HTTPVersion = HTTPVersion(major: 1, minor: 1), method: HTTPMethod = .GET, headers: HTTPHeaders = HTTPHeaders(), body: Body? = nil) throws {
136+
public init(url: URL, method: HTTPMethod = .GET, headers: HTTPHeaders = HTTPHeaders(), body: Body? = nil) throws {
139137
guard let scheme = url.scheme?.lowercased() else {
140138
throw HTTPClientError.emptyScheme
141139
}
@@ -148,7 +146,6 @@ extension HTTPClient {
148146
throw HTTPClientError.emptyHost
149147
}
150148

151-
self.version = version
152149
self.method = method
153150
self.url = url
154151
self.scheme = scheme
@@ -444,10 +441,10 @@ internal class TaskHandler<T: HTTPClientResponseDelegate>: ChannelInboundHandler
444441
self.state = .idle
445442
let request = unwrapOutboundIn(data)
446443

447-
var head = HTTPRequestHead(version: request.version, method: request.method, uri: request.url.uri)
444+
var head = HTTPRequestHead(version: HTTPVersion(major: 1, minor: 1), method: request.method, uri: request.url.uri)
448445
var headers = request.headers
449446

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

@@ -680,7 +677,7 @@ internal struct RedirectHandler<T> {
680677
}
681678

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

0 commit comments

Comments
 (0)