Browse Source

Make it easier to switch between the global request method and a manager

When you need to customize a header or timeout, this makes the delta
between your existing code and code using the manager smaller.
Brian Smith 11 years ago
parent
commit
dafd818a9e
1 changed files with 15 additions and 0 deletions
  1. 15 0
      Source/Alamofire.swift

+ 15 - 0
Source/Alamofire.swift

@@ -294,6 +294,21 @@ public class Manager {
 
     // MARK: -
 
+    /**
+        Creates a request for the specified method, URL string, parameters, and parameter encoding.
+
+        :param: method The HTTP method.
+        :param: URLString The URL string.
+        :param: parameters The parameters. `nil` by default.
+        :param: encoding The parameter encoding. `.URL` by default.
+
+        :returns: The created request.
+    */
+    public func request(method: Method, _ URLString: URLStringConvertible, parameters: [String: AnyObject]? = nil, encoding: ParameterEncoding = .URL) -> Request {
+        return request(encoding.encode(URLRequest(method, URLString), parameters: parameters).0)
+    }
+
+
     /**
         Creates a request for the specified URL request.