From 5c22a3c79fde769469468a724462154fd87e9a16 Mon Sep 17 00:00:00 2001 From: Harish Kumar S Date: Fri, 12 Jul 2019 09:44:04 +0530 Subject: [PATCH] Fix to set property ClientResponse.status right Kitura-NIO wrongly returned -1 as status code.The property ClientResponse.status now updates when ClientResponse.statusCode is updated.Observer didSet is removed from ClientResponse.status as observers of both status and statusCode trigger each other and cause stackoverflow.The changes made ensure the property ClientResonse.status is set right. --- Sources/KituraNet/ClientResponse.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Sources/KituraNet/ClientResponse.swift b/Sources/KituraNet/ClientResponse.swift index 0b1a75f2..582b140c 100644 --- a/Sources/KituraNet/ClientResponse.swift +++ b/Sources/KituraNet/ClientResponse.swift @@ -53,16 +53,13 @@ public class ClientResponse { } } /// The HTTP Status code, as an Int, sent in the response by the remote server. - public internal(set) var status = -1 { - didSet { - statusCode = HTTPStatusCode(rawValue: status) ?? .unknown - } - } + public internal(set) var status = -1 /// The HTTP Status code, as an `HTTPStatusCode`, sent in the response by the remote server. public internal(set) var statusCode: HTTPStatusCode = HTTPStatusCode.unknown { didSet { httpStatusCode = statusCode + status = statusCode.rawValue } }