 
                 var finalHeaders = headers
                 var contentType:String? = nil
+                var body:NSData?
 
                 if let requestData = requestBody {
                     body = requestData
+                } else if files.count > 0 {
+                    body = synthesizeMultipartBody(data, files:files)
+                    contentType = "multipart/form-data; boundary=\(kHTTPMultipartBodyBoundary)"
                 } else {
                     if let requestJSON = json {
                         contentType = "application/json"

            var requestResult:HTTPResult = HTTPResult(data: nil, response: nil, error: syncResultAccessError, request: nil)

            let config = TaskConfiguration(credential:auth, redirects:redirects)
            if let request = synthesizeRequest(method, URLString: URLString, params: params, data: data, json: json, headers: CaseInsensitiveDictionary<String,String>(dictionary:headers), requestBody:requestBody, URLQuery: URLQuery) {
                addCookies(request.URL!, newCookies: cookies)
                let task = makeTask(request, configuration:config) { (result) in
                    if let handler = asyncCompletionHandler {

//

import Foundation


struct JustSessionConfig {
    var JSONReadingOptions: NSJSONReadingOptions? = nil
