kif-framework / AMYServer

A mock server fully integrated with KIF.
Other
59 stars 11 forks source link

addRequestForProtocol won't be called. with Alamofire #12

Open wanbok opened 8 years ago

wanbok commented 8 years ago

Hi,

I'm using [Alamofire]() on my project and trying to use AMYServer. But it's not worked.

Because - (id)initWithRequest:(NSURLRequest *)request cachedResponse:(NSCachedURLResponse *)cachedResponse client:(id<NSURLProtocolClient>)client isn't called.

Therefore _AMYURLProtocol's pendingRequests has nothing.

bnickel commented 8 years ago

I'd wager that the current setup doesn't work properly with NSURLSession. I believe we need to incorporate this fix where we do registerClass: http://stackoverflow.com/a/28720198/860000

wanbok commented 8 years ago

@bnickel registerClass is already run by AMYServer's start method. I found some article from OHHTTPStubs's issue