Browse Source

[PR #1330] NSURLRequest and mutable variant data now maintained in top-level APIs.

# Conflicts:
#	Source/Alamofire.swift
passchaos 9 years ago
parent
commit
372822c3e5
1 changed files with 4 additions and 1 deletions
  1. 4 1
      Source/Alamofire.swift

+ 4 - 1
Source/Alamofire.swift

@@ -88,11 +88,14 @@ extension Foundation.URLRequest: URLRequestConvertible {
 extension URLRequest {
 extension URLRequest {
     init(_ method: Method, _ urlString: URLStringConvertible, headers: [String:String]? = nil) {
     init(_ method: Method, _ urlString: URLStringConvertible, headers: [String:String]? = nil) {
         self.init(url: URL(string: urlString.urlString)!)
         self.init(url: URL(string: urlString.urlString)!)
+
+        if let request = urlString as? URLRequest { self = request }
+
         self.httpMethod = method.rawValue
         self.httpMethod = method.rawValue
 
 
         if let headers = headers {
         if let headers = headers {
             for (headerField, headerValue) in headers {
             for (headerField, headerValue) in headers {
-                self.setValue(headerValue, forHTTPHeaderField: headerField)
+                setValue(headerValue, forHTTPHeaderField: headerField)
             }
             }
         }
         }
     }
     }