                 if response.isSuccess() {
                     success(response, JSON(data: data ?? NSData()))
                 } else {
-                    dataTaskFailureHandler(response, error: error)
+                    dataTaskFailureHandler(data, response:response, error: error)
                 }
             }
             else {
-                dataTaskFailureHandler(nil, error: error)
+                dataTaskFailureHandler(nil, response:nil, error: error)
             }
         }
 

    }

    ///Utility method to print response and error objects for debugging purposes
    private func printResult(response:NSHTTPURLResponse?, error:NSError?) {
        if let response = response {
            print("httpDataTask response: \(response)")
        }

        if let error = error {
            print("httpDataTask error: \(error.localizedDescription)")
        }
    }
}
                              success:HTTPJSONSuccessClosure,
                              failure:HTTPJSONFailureClosure) -> NSURLSessionDataTask?
    {
        func dataTaskFailureHandler(data:NSData?, response:NSHTTPURLResponse?, error:NSError?) {
            #if DEBUG
                printResult(data, response: response, error: error)
            #endif
            failure(response, error)
        }

        //ensure request is valid
        guard let request:NSMutableURLRequest = NSMutableURLRequest(URL: url) else {
            dataTaskFailureHandler(nil, response:nil, error: NSError(domain: "NSURLSession.httpPost.badRequest", code: 0, userInfo: nil))
            return nil
        }

