     }
 
     private func dictToQueryString(data: [String: String]) -> String {
+
         var qs = ""
         for (key, value) in data {
-            qs += "\(key)=\(value)&"
+            let encodedKey = encode(key)
+            let encodedValue = encode(value)
+            qs += "\(encodedKey)=\(encodedValue)&"
         }
         return qs
     }
+    
+    private func encode(value: String) -> String {
+        let queryCharacters =  NSCharacterSet(charactersInString:" =\"#%/<>?@\\^`{}[]|&+").invertedSet
+        
+        let encodedValue:String = value.stringByAddingPercentEncodingWithAllowedCharacters(queryCharacters)!
+        
+        return encodedValue
+    }
 }

        }
        
        let task = session.dataTaskWithRequest(urlRequest, completionHandler: {body, response, err in
            // this is lame but want to not always send back NSData. Is it reasonable to intelligent about MIME types and send back a string when it makes sense?
            var resp = response as NSHTTPURLResponse
            if( err == nil) {
                if(response.MIMEType == "text/html" || response.MIMEType == "application/json" ) {
                    var bodyStr = NSString(data: body, encoding:NSUTF8StringEncoding)
                    return callback!(err: err, response: resp, body: bodyStr)
                }
            }
            

        request(["url": url, "method" : "POST", "body" : qs, "auth" : auth] , callback)
    }
    
    // Actually make the request
    func request(options: [String: Any], callback: ((err: NSError?, response: NSHTTPURLResponse?, body: AnyObject?)->())?) {
        if( options["url"] == nil ) { return }
        
