diff --git a/Sources/KituraNet/HTTP/HTTPServerRequest.swift b/Sources/KituraNet/HTTP/HTTPServerRequest.swift index 480acad1..49b5e81f 100644 --- a/Sources/KituraNet/HTTP/HTTPServerRequest.swift +++ b/Sources/KituraNet/HTTP/HTTPServerRequest.swift @@ -24,11 +24,7 @@ import Foundation public class HTTPServerRequest: ServerRequest { /// Set of HTTP headers of the request. - public var headers : HeadersContainer { - return HeadersContainer.create(from: _headers) - } - - private var _headers: HTTPHeaders + public var headers : HeadersContainer @available(*, deprecated, message: "This contains just the path and query parameters starting with '/'. use 'urlURL' instead") public var urlString : String { @@ -58,7 +54,7 @@ public class HTTPServerRequest: ServerRequest { self.enableSSL ? url.append("https://") : url.append("http://") - if let hostname = _headers["Host"].first { + if let hostname = headers["Host"]?.first { url.append(hostname) if !hostname.contains(":") { url.append(":") @@ -120,7 +116,7 @@ public class HTTPServerRequest: ServerRequest { } init(ctx: ChannelHandlerContext, requestHead: HTTPRequestHead, enableSSL: Bool) { - self._headers = requestHead.headers + self.headers = HeadersContainer.create(from: requestHead.headers) self.method = String(describing: requestHead.method) self.httpVersionMajor = requestHead.version.major self.httpVersionMinor = requestHead.version.minor