I have a custom NSURLProtocol class to provide test data while I'm experimenting with Alamofire, but it doesn't seem to be used when querying through the Manager's request method.
This request passes and returns the result just fine, but does not call canInitWithRequest:
NSURLProtocol.registerClass(DBDummyURLProtocol) class MyURLRequestConvertible : URLRequestConvertible { var URLRequest: NSURLRequest { return NSURLRequest(URL: NSURL(scheme: "http", host: "cnn.com", path: "/")!) } } var myURLRequestConvertible = MyURLRequestConvertible(); Manager.sharedInstance.request(myURLRequestConvertible)
If I use a simple NSURLConnection, the canInitWithRequest method is called as I expected:
NSURLProtocol.registerClass(DBDummyURLProtocol) var request = NSURLRequest(URL: NSURL(scheme: "http", host: "cnn.com", path: "/")!) NSURLConnection(request: request, delegate:nil, startImmediately:true)
Am I doing something wrong? Should this work with Alamofire?
alamofire
Doug sjoquist
source share