diff --git a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache index b544298de362..a369e6f0eea5 100644 --- a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache @@ -92,10 +92,6 @@ private var credentialStore = SynchronizedDictionary() originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ private var credentialStore = SynchronizedDictionary() {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in {{projectName}}API.customHeaders { httpHeaders[key] = value } - for (key, value) in {{projectName}}API.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 635c69cd6a8a..da9dca29ac46 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -92,10 +92,6 @@ open class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ open class URLSessionRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 635c69cd6a8a..da9dca29ac46 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -92,10 +92,6 @@ open class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ open class URLSessionRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 635c69cd6a8a..da9dca29ac46 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -92,10 +92,6 @@ open class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ open class URLSessionRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 635c69cd6a8a..da9dca29ac46 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -92,10 +92,6 @@ open class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ open class URLSessionRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders diff --git a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 635c69cd6a8a..da9dca29ac46 100644 --- a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -92,10 +92,6 @@ open class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ open class URLSessionRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index e8f1e1ec614a..86926821e793 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -92,10 +92,6 @@ internal class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ internal class URLSessionRequestBuilder: RequestBuilder { internal func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 635c69cd6a8a..da9dca29ac46 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -92,10 +92,6 @@ open class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ open class URLSessionRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders diff --git a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 635c69cd6a8a..da9dca29ac46 100644 --- a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -92,10 +92,6 @@ open class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ open class URLSessionRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 635c69cd6a8a..da9dca29ac46 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -92,10 +92,6 @@ open class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ open class URLSessionRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 635c69cd6a8a..da9dca29ac46 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -92,10 +92,6 @@ open class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ open class URLSessionRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 635c69cd6a8a..da9dca29ac46 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -92,10 +92,6 @@ open class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ open class URLSessionRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 635c69cd6a8a..da9dca29ac46 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -92,10 +92,6 @@ open class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ open class URLSessionRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift index 635c69cd6a8a..da9dca29ac46 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift @@ -92,10 +92,6 @@ open class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ open class URLSessionRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders diff --git a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 635c69cd6a8a..da9dca29ac46 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -92,10 +92,6 @@ open class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -218,10 +214,10 @@ open class URLSessionRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders