      - returns: NSURLRequest with manipulated resource identifier.
      */
     func mockRequest(request: NSURLRequest) -> NSURLRequest {
-        
+        guard let url = request.URL else {
+            return request
+        }
         let requestMethod = RequestMethod(rawValue: request.HTTPMethod!)!
         
-        let mockURL = mockURLForRequestURL(request.URL!, requestMethod: requestMethod, mocks: mocks)
+        let mockURL = mockURLForRequestURL(url, requestMethod: requestMethod, mocks: mocks)
         if mockURL == request.URL {
             return request
         }


class FileHelper {
    
    private static let maxFileLegth = 50
}

//MARK: public methods

    private func mockURLForRequestURL(url: NSURL, requestMethod: RequestMethod, mocks: Dictionary<String,AnyObject>, isData: Bool) -> NSURL? {
        
        guard let definitionsForMethod = mocks[requestMethod.rawValue] as? Dictionary<String,AnyObject> else {
            fatalError("Couldn't find definitions for request: \(requestMethod) make sure to create a node for it in the plist and include your plist file in the correct target")
        }
        
        if let responseFiles = definitionsForMethod[url.absoluteString] as? [String:String] {
