From 4afbab54b5b629668b9ba1f2829bbf95470c428f Mon Sep 17 00:00:00 2001 From: Nickolas Pohilets Date: Sat, 29 Apr 2017 01:43:10 +0200 Subject: [PATCH 1/8] Implemented proxies for OHHTTPStubsProtocol for injecting instance of OHHTTPStubs --- OHHTTPStubs/Sources/OHHTTPStubs.m | 322 ++++++++++++++++++++++-------- 1 file changed, 237 insertions(+), 85 deletions(-) diff --git a/OHHTTPStubs/Sources/OHHTTPStubs.m b/OHHTTPStubs/Sources/OHHTTPStubs.m index ecba10ef..85a5d5cc 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubs.m +++ b/OHHTTPStubs/Sources/OHHTTPStubs.m @@ -30,11 +30,33 @@ #pragma mark - Imports #import "OHHTTPStubs.h" +#import //////////////////////////////////////////////////////////////////////////////// #pragma mark - Types & Constants -@interface OHHTTPStubsProtocol : NSURLProtocol @end +@interface OHHTTPStubsProtocolClassProxy : NSProxy + +- (instancetype)initWithStubs:(OHHTTPStubs*)stubs; + +@end + +@interface OHHTTPStubsProtocolInstanceProxy : NSProxy + +- (instancetype)initWithStubs:(OHHTTPStubs *)stubs; + +@property(atomic, weak, readonly) OHHTTPStubs* stubs; + +@end + +@interface OHHTTPStubsProtocol : NSURLProtocol + +- (id)initWithStubs:(OHHTTPStubs *)stubs + request:(NSURLRequest *)request + cachedResponse:(NSCachedURLResponse *)response + client:(id)client; + +@end static NSTimeInterval const kSlotTime = 0.25; // Must be >0. We will send a chunk of the data from the stream each 'slotTime' seconds @@ -43,6 +65,7 @@ @interface OHHTTPStubsProtocol : NSURLProtocol @end @interface OHHTTPStubs() + (instancetype)sharedInstance; +@property(atomic, strong) id protocolClass; @property(atomic, copy) NSMutableArray* stubDescriptors; @property(atomic, assign) BOOL enabledState; @property(atomic, copy, nullable) void (^onStubActivationBlock)(NSURLRequest*, id, OHHTTPStubsResponse*); @@ -78,9 +101,6 @@ -(NSString*)description @end - - - //////////////////////////////////////////////////////////////////////////////// #pragma mark - OHHTTPStubs Implementation @@ -95,36 +115,34 @@ + (instancetype)sharedInstance static dispatch_once_t predicate; dispatch_once(&predicate, ^{ - sharedInstance = [[self alloc] init]; + sharedInstance = [[self alloc] initEnabled:YES]; }); - return sharedInstance; } //////////////////////////////////////////////////////////////////////////////// #pragma mark - Setup & Teardown -+ (void)initialize -{ - if (self == [OHHTTPStubs class]) - { - [self _setEnable:YES]; - } -} -- (instancetype)init +- (instancetype)initEnabled:(BOOL)enabled { self = [super init]; if (self) { _stubDescriptors = [NSMutableArray array]; - _enabledState = YES; // assume initialize has already been run + _protocolClass = [[OHHTTPStubsProtocolClassProxy alloc] initWithStubs:self]; + _enabledState = enabled; + if (enabled) { + [self _setEnable:YES]; + } } return self; } - (void)dealloc { - [self.class _setEnable:NO]; + if (_enabledState) { + [self _setEnable:NO]; + } } //////////////////////////////////////////////////////////////////////////////// @@ -153,18 +171,6 @@ +(void)removeAllStubs #pragma mark > Disabling & Re-Enabling stubs -+(void)_setEnable:(BOOL)enable -{ - if (enable) - { - [NSURLProtocol registerClass:OHHTTPStubsProtocol.class]; - } - else - { - [NSURLProtocol unregisterClass:OHHTTPStubsProtocol.class]; - } -} - +(void)setEnabled:(BOOL)enabled { [OHHTTPStubs.sharedInstance setEnabled:enabled]; @@ -178,47 +184,12 @@ +(BOOL)isEnabled #if defined(__IPHONE_7_0) || defined(__MAC_10_9) + (void)setEnabled:(BOOL)enable forSessionConfiguration:(NSURLSessionConfiguration*)sessionConfig { - // Runtime check to make sure the API is available on this version - if ( [sessionConfig respondsToSelector:@selector(protocolClasses)] - && [sessionConfig respondsToSelector:@selector(setProtocolClasses:)]) - { - NSMutableArray * urlProtocolClasses = [NSMutableArray arrayWithArray:sessionConfig.protocolClasses]; - Class protoCls = OHHTTPStubsProtocol.class; - if (enable && ![urlProtocolClasses containsObject:protoCls]) - { - [urlProtocolClasses insertObject:protoCls atIndex:0]; - } - else if (!enable && [urlProtocolClasses containsObject:protoCls]) - { - [urlProtocolClasses removeObject:protoCls]; - } - sessionConfig.protocolClasses = urlProtocolClasses; - } - else - { - NSLog(@"[OHHTTPStubs] %@ is only available when running on iOS7+/OSX9+. " - @"Use conditions like 'if ([NSURLSessionConfiguration class])' to only call " - @"this method if the user is running iOS7+/OSX9+.", NSStringFromSelector(_cmd)); - } + [OHHTTPStubs.sharedInstance setEnabled:enable forSessionConfiguration:sessionConfig]; } + (BOOL)isEnabledForSessionConfiguration:(NSURLSessionConfiguration *)sessionConfig { - // Runtime check to make sure the API is available on this version - if ( [sessionConfig respondsToSelector:@selector(protocolClasses)] - && [sessionConfig respondsToSelector:@selector(setProtocolClasses:)]) - { - NSMutableArray * urlProtocolClasses = [NSMutableArray arrayWithArray:sessionConfig.protocolClasses]; - Class protoCls = OHHTTPStubsProtocol.class; - return [urlProtocolClasses containsObject:protoCls]; - } - else - { - NSLog(@"[OHHTTPStubs] %@ is only available when running on iOS7+/OSX9+. " - @"Use conditions like 'if ([NSURLSessionConfiguration class])' to only call " - @"this method if the user is running iOS7+/OSX9+.", NSStringFromSelector(_cmd)); - return NO; - } + return [OHHTTPStubs.sharedInstance isEnabledForSessionConfiguration:sessionConfig]; } #endif @@ -264,10 +235,69 @@ -(void)setEnabled:(BOOL)enable @synchronized(self) { _enabledState = enable; - [self.class _setEnable:_enabledState]; + [self _setEnable:_enabledState]; + } +} + +-(void)_setEnable:(BOOL)enable +{ + if (enable) + { + [NSURLProtocol registerClass:[self protocolClass]]; + } + else + { + [NSURLProtocol unregisterClass:[self protocolClass]]; } } +#if defined(__IPHONE_7_0) || defined(__MAC_10_9) +- (void)setEnabled:(BOOL)enable forSessionConfiguration:(NSURLSessionConfiguration*)sessionConfig +{ + // Runtime check to make sure the API is available on this version + if ( [sessionConfig respondsToSelector:@selector(protocolClasses)] + && [sessionConfig respondsToSelector:@selector(setProtocolClasses:)]) + { + NSMutableArray * urlProtocolClasses = [NSMutableArray arrayWithArray:sessionConfig.protocolClasses]; + id protoCls = [self protocolClass]; + if (enable && ![urlProtocolClasses containsObject:protoCls]) + { + [urlProtocolClasses insertObject:protoCls atIndex:0]; + } + else if (!enable && [urlProtocolClasses containsObject:protoCls]) + { + [urlProtocolClasses removeObject:protoCls]; + } + sessionConfig.protocolClasses = urlProtocolClasses; + } + else + { + NSLog(@"[OHHTTPStubs] %@ is only available when running on iOS7+/OSX9+. " + @"Use conditions like 'if ([NSURLSessionConfiguration class])' to only call " + @"this method if the user is running iOS7+/OSX9+.", NSStringFromSelector(_cmd)); + } +} + +- (BOOL)isEnabledForSessionConfiguration:(NSURLSessionConfiguration *)sessionConfig +{ + // Runtime check to make sure the API is available on this version + if ( [sessionConfig respondsToSelector:@selector(protocolClasses)] + && [sessionConfig respondsToSelector:@selector(setProtocolClasses:)]) + { + NSMutableArray * urlProtocolClasses = [NSMutableArray arrayWithArray:sessionConfig.protocolClasses]; + id protoCls = [self protocolClass]; + return [urlProtocolClasses containsObject:protoCls]; + } + else + { + NSLog(@"[OHHTTPStubs] %@ is only available when running on iOS7+/OSX9+. " + @"Use conditions like 'if ([NSURLSessionConfiguration class])' to only call " + @"this method if the user is running iOS7+/OSX9+.", NSStringFromSelector(_cmd)); + return NO; + } +} +#endif + -(void)addStub:(OHHTTPStubsDescriptor*)stubDesc { @synchronized(_stubDescriptors) @@ -326,31 +356,153 @@ - (OHHTTPStubsDescriptor*)firstStubPassingTestForRequest:(NSURLRequest*)request //////////////////////////////////////////////////////////////////////////////// #pragma mark - Private Protocol Class +@interface NSURLProtocol() + ++ (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request task:(NSURLSessionTask*)task; + +@end + +@implementation OHHTTPStubsProtocolClassProxy +{ + OHHTTPStubsProtocolInstanceProxy *_instance; +} + +- (instancetype)initWithStubs:(OHHTTPStubs *)stubs { + _instance = [[OHHTTPStubsProtocolInstanceProxy alloc] initWithStubs:stubs]; + return self; +} + +- (Class)superclass { + return [OHHTTPStubsProtocol superclass]; +} + +- (Class)class { + return (id)self; +} + +- (BOOL)isSubclassOfClass:(Class)klass { + return [OHHTTPStubsProtocol isSubclassOfClass:klass]; +} + +- (BOOL)canInitWithRequest:(NSURLRequest *)request +{ + return ([_instance.stubs firstStubPassingTestForRequest:request] != nil); +} + +- (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request +{ + return request; +} + +- (id)alloc NS_RETURNS_RETAINED { + return _instance; +} + +- (BOOL)respondsToSelector:(SEL)aSelector { + return [OHHTTPStubsProtocol respondsToSelector:aSelector]; +} + +- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel { + return [OHHTTPStubsProtocol methodSignatureForSelector:sel]; +} + ++ (BOOL)resolveInstanceMethod:(SEL)sel { + Method m = class_getClassMethod(OHHTTPStubsProtocol.self, sel); + if (!m) { + return NO; + } + class_addMethod(self, sel, method_getImplementation(m), method_getTypeEncoding(m)); + return YES; +} + +@end + +@implementation OHHTTPStubsProtocolInstanceProxy + +- (instancetype)initWithStubs:(OHHTTPStubs *)stubs { + _stubs = stubs; + return self; +} + +- (id)initWithRequest:(NSURLRequest *)request cachedResponse:(NSCachedURLResponse *)response client:(id)client { + return (id)[[OHHTTPStubsProtocol alloc] initWithStubs:_stubs request:request cachedResponse:response client:client]; +} + +- (Class)class { + NSAssert(NO, @"-[OHHTTPStubsProtocolInstanceProxy class] is not implemented"); + return [OHHTTPStubsProtocol class]; +} + +- (Class)superclass { + return [OHHTTPStubsProtocol superclass]; +} + +- (BOOL)respondsToSelector:(SEL)aSelector { + return [OHHTTPStubsProtocol instancesRespondToSelector:aSelector]; +} + +- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel { + return [OHHTTPStubsProtocol instanceMethodSignatureForSelector:sel]; +} + ++ (BOOL)resolveInstanceMethod:(SEL)sel { + Method m = class_getInstanceMethod(OHHTTPStubsProtocol.self, sel); + if (!m) { + return NO; + } + + class_addMethod(self, sel, method_getImplementation(m), method_getTypeEncoding(m)); + return YES; +} + +@end + + @interface OHHTTPStubsProtocol() @property(assign) BOOL stopped; +@property(strong) OHHTTPStubs* stubs; @property(strong) OHHTTPStubsDescriptor* stub; @property(assign) CFRunLoopRef clientRunLoop; - (void)executeOnClientRunLoopAfterDelay:(NSTimeInterval)delayInSeconds block:(dispatch_block_t)block; @end @implementation OHHTTPStubsProtocol - -+ (BOOL)canInitWithRequest:(NSURLRequest *)request { - return ([OHHTTPStubs.sharedInstance firstStubPassingTestForRequest:request] != nil); + OHHTTPStubs *_stubs; } -- (id)initWithRequest:(NSURLRequest *)request cachedResponse:(NSCachedURLResponse *)response client:(id)client ++ (BOOL)canInitWithTask:(NSURLSessionTask *)task { + return [super canInitWithTask:task]; +} + +- (id)initWithStubs:(OHHTTPStubs *)stubs + request:(NSURLRequest *)request + cachedResponse:(NSCachedURLResponse *)response + client:(id)client { + NSParameterAssert(stubs); + // Make super sure that we never use a cached response. - OHHTTPStubsProtocol* proto = [super initWithRequest:request cachedResponse:nil client:client]; - proto.stub = [OHHTTPStubs.sharedInstance firstStubPassingTestForRequest:request]; - return proto; + self = [super initWithRequest:request cachedResponse:nil client:client]; + if (self) { + self.stubs = stubs; + self.stub = [stubs firstStubPassingTestForRequest:self.request]; + } + return self; } -+ (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request +- (id)initWithStubs:(OHHTTPStubs *)stubs + task:(NSURLSessionTask *)task + cachedResponse:(NSCachedURLResponse *)cachedResponse + client:(id)client { - return request; + // Make super sure that we never use a cached response. + self = [super initWithTask:task cachedResponse:nil client:client]; + if (self) { + self.stubs = stubs; + self.stub = [stubs firstStubPassingTestForRequest:self.request]; + } + return self; } - (NSCachedURLResponse *)cachedResponse @@ -376,18 +528,18 @@ - (void)startLoading nil]; NSError* error = [NSError errorWithDomain:@"OHHTTPStubs" code:500 userInfo:userInfo]; [client URLProtocol:self didFailWithError:error]; - if (OHHTTPStubs.sharedInstance.afterStubFinishBlock) + if (self.stubs.afterStubFinishBlock) { - OHHTTPStubs.sharedInstance.afterStubFinishBlock(request, self.stub, nil, error); + self.stubs.afterStubFinishBlock(request, self.stub, nil, error); } return; } OHHTTPStubsResponse* responseStub = self.stub.responseBlock(request); - if (OHHTTPStubs.sharedInstance.onStubActivationBlock) + if (self.stubs.onStubActivationBlock) { - OHHTTPStubs.sharedInstance.onStubActivationBlock(request, self.stub, responseStub); + self.stubs.onStubActivationBlock(request, self.stub, responseStub); } if (responseStub.error == nil) @@ -426,9 +578,9 @@ - (void)startLoading { NSURLRequest* redirectRequest = [NSURLRequest requestWithURL:redirectLocationURL]; [client URLProtocol:self wasRedirectedToRequest:redirectRequest redirectResponse:urlResponse]; - if (OHHTTPStubs.sharedInstance.onStubRedirectBlock) + if (self.stubs.onStubRedirectBlock) { - OHHTTPStubs.sharedInstance.onStubRedirectBlock(request, redirectRequest, self.stub, responseStub); + self.stubs.onStubRedirectBlock(request, redirectRequest, self.stub, responseStub); } } @@ -453,9 +605,9 @@ - (void)startLoading [client URLProtocol:self didFailWithError:responseStub.error]; blockError = responseStub.error; } - if (OHHTTPStubs.sharedInstance.afterStubFinishBlock) + if (self.stubs.afterStubFinishBlock) { - OHHTTPStubs.sharedInstance.afterStubFinishBlock(request, self.stub, responseStub, blockError); + self.stubs.afterStubFinishBlock(request, self.stub, responseStub, blockError); } }]; } @@ -466,9 +618,9 @@ - (void)startLoading if (!self.stopped) { [client URLProtocol:self didFailWithError:responseStub.error]; - if (OHHTTPStubs.sharedInstance.afterStubFinishBlock) + if (self.stubs.afterStubFinishBlock) { - OHHTTPStubs.sharedInstance.afterStubFinishBlock(request, self.stub, responseStub, responseStub.error); + self.stubs.afterStubFinishBlock(request, self.stub, responseStub, responseStub.error); } } }]; From ae616bc71077d70249729334ca8cb769db1fb050 Mon Sep 17 00:00:00 2001 From: Nickolas Pohilets Date: Sat, 29 Apr 2017 13:07:01 +0200 Subject: [PATCH 2/8] Moved OHHTTPStubsProtocol into separate file --- Examples/ObjC/Podfile.lock | 4 +- .../OHHTTPStubs/OHHTTPStubsDescriptor.h | 1 + .../Private/OHHTTPStubs/OHHTTPStubsProtocol.h | 1 + .../Private/OHHTTPStubs/OHHTTPStubsTypes.h | 1 + .../Public/OHHTTPStubs/OHHTTPStubsTypes.h | 1 + .../Local Podspecs/OHHTTPStubs.podspec.json | 6 +- Examples/ObjC/Pods/Manifest.lock | 4 +- .../ObjC/Pods/Pods.xcodeproj/project.pbxproj | 344 +++++++------ Examples/Swift/Podfile.lock | 4 +- .../Local Podspecs/OHHTTPStubs.podspec.json | 6 +- Examples/Swift/Pods/Manifest.lock | 4 +- .../Swift/Pods/Pods.xcodeproj/project.pbxproj | 356 +++++++------ .../OHHTTPStubs/OHHTTPStubs-umbrella.h | 1 + OHHTTPStubs.podspec | 1 + .../OHHTTPStubs.xcodeproj/project.pbxproj | 50 ++ OHHTTPStubs/Sources/OHHTTPStubs.h | 32 +- OHHTTPStubs/Sources/OHHTTPStubs.m | 479 +----------------- OHHTTPStubs/Sources/OHHTTPStubsDescriptor.h | 20 + OHHTTPStubs/Sources/OHHTTPStubsDescriptor.m | 29 ++ OHHTTPStubs/Sources/OHHTTPStubsProtocol.h | 47 ++ OHHTTPStubs/Sources/OHHTTPStubsProtocol.m | 400 +++++++++++++++ OHHTTPStubs/Sources/OHHTTPStubsTypes.h | 39 ++ 22 files changed, 999 insertions(+), 831 deletions(-) create mode 120000 Examples/ObjC/Pods/Headers/Private/OHHTTPStubs/OHHTTPStubsDescriptor.h create mode 120000 Examples/ObjC/Pods/Headers/Private/OHHTTPStubs/OHHTTPStubsProtocol.h create mode 120000 Examples/ObjC/Pods/Headers/Private/OHHTTPStubs/OHHTTPStubsTypes.h create mode 120000 Examples/ObjC/Pods/Headers/Public/OHHTTPStubs/OHHTTPStubsTypes.h create mode 100644 OHHTTPStubs/Sources/OHHTTPStubsDescriptor.h create mode 100644 OHHTTPStubs/Sources/OHHTTPStubsDescriptor.m create mode 100644 OHHTTPStubs/Sources/OHHTTPStubsProtocol.h create mode 100644 OHHTTPStubs/Sources/OHHTTPStubsProtocol.m create mode 100644 OHHTTPStubs/Sources/OHHTTPStubsTypes.h diff --git a/Examples/ObjC/Podfile.lock b/Examples/ObjC/Podfile.lock index 97295404..6168855b 100644 --- a/Examples/ObjC/Podfile.lock +++ b/Examples/ObjC/Podfile.lock @@ -18,10 +18,10 @@ DEPENDENCIES: EXTERNAL SOURCES: OHHTTPStubs: - :path: "../.." + :path: ../.. SPEC CHECKSUMS: - OHHTTPStubs: dbe7fc78b805b075ff74bb20922854d0dca8679b + OHHTTPStubs: 5a78fe08e8f13065df05203a1f8f56b4a243ee17 PODFILE CHECKSUM: 3b00a315b869401f03c1a7c408a9754a8e4c62d8 diff --git a/Examples/ObjC/Pods/Headers/Private/OHHTTPStubs/OHHTTPStubsDescriptor.h b/Examples/ObjC/Pods/Headers/Private/OHHTTPStubs/OHHTTPStubsDescriptor.h new file mode 120000 index 00000000..0cb5b02c --- /dev/null +++ b/Examples/ObjC/Pods/Headers/Private/OHHTTPStubs/OHHTTPStubsDescriptor.h @@ -0,0 +1 @@ +../../../../../../OHHTTPStubs/Sources/OHHTTPStubsDescriptor.h \ No newline at end of file diff --git a/Examples/ObjC/Pods/Headers/Private/OHHTTPStubs/OHHTTPStubsProtocol.h b/Examples/ObjC/Pods/Headers/Private/OHHTTPStubs/OHHTTPStubsProtocol.h new file mode 120000 index 00000000..d89b9e45 --- /dev/null +++ b/Examples/ObjC/Pods/Headers/Private/OHHTTPStubs/OHHTTPStubsProtocol.h @@ -0,0 +1 @@ +../../../../../../OHHTTPStubs/Sources/OHHTTPStubsProtocol.h \ No newline at end of file diff --git a/Examples/ObjC/Pods/Headers/Private/OHHTTPStubs/OHHTTPStubsTypes.h b/Examples/ObjC/Pods/Headers/Private/OHHTTPStubs/OHHTTPStubsTypes.h new file mode 120000 index 00000000..b5a5d0ab --- /dev/null +++ b/Examples/ObjC/Pods/Headers/Private/OHHTTPStubs/OHHTTPStubsTypes.h @@ -0,0 +1 @@ +../../../../../../OHHTTPStubs/Sources/OHHTTPStubsTypes.h \ No newline at end of file diff --git a/Examples/ObjC/Pods/Headers/Public/OHHTTPStubs/OHHTTPStubsTypes.h b/Examples/ObjC/Pods/Headers/Public/OHHTTPStubs/OHHTTPStubsTypes.h new file mode 120000 index 00000000..b5a5d0ab --- /dev/null +++ b/Examples/ObjC/Pods/Headers/Public/OHHTTPStubs/OHHTTPStubsTypes.h @@ -0,0 +1 @@ +../../../../../../OHHTTPStubs/Sources/OHHTTPStubsTypes.h \ No newline at end of file diff --git a/Examples/ObjC/Pods/Local Podspecs/OHHTTPStubs.podspec.json b/Examples/ObjC/Pods/Local Podspecs/OHHTTPStubs.podspec.json index b4b1a131..2bf7f5e3 100644 --- a/Examples/ObjC/Pods/Local Podspecs/OHHTTPStubs.podspec.json +++ b/Examples/ObjC/Pods/Local Podspecs/OHHTTPStubs.podspec.json @@ -45,7 +45,11 @@ { "name": "Core", "source_files": "OHHTTPStubs/Sources/*.{h,m}", - "public_header_files": "OHHTTPStubs/Sources/*.h" + "public_header_files": "OHHTTPStubs/Sources/*.h", + "private_header_files": [ + "OHHTTPStubs/Sources/OHHTTPStubsDescriptor.h", + "OHHTTPStubs/Sources/OHHTTPStubsProtocol.h" + ] }, { "name": "NSURLSession", diff --git a/Examples/ObjC/Pods/Manifest.lock b/Examples/ObjC/Pods/Manifest.lock index 97295404..6168855b 100644 --- a/Examples/ObjC/Pods/Manifest.lock +++ b/Examples/ObjC/Pods/Manifest.lock @@ -18,10 +18,10 @@ DEPENDENCIES: EXTERNAL SOURCES: OHHTTPStubs: - :path: "../.." + :path: ../.. SPEC CHECKSUMS: - OHHTTPStubs: dbe7fc78b805b075ff74bb20922854d0dca8679b + OHHTTPStubs: 5a78fe08e8f13065df05203a1f8f56b4a243ee17 PODFILE CHECKSUM: 3b00a315b869401f03c1a7c408a9754a8e4c62d8 diff --git a/Examples/ObjC/Pods/Pods.xcodeproj/project.pbxproj b/Examples/ObjC/Pods/Pods.xcodeproj/project.pbxproj index 18af7156..57d0a54f 100644 --- a/Examples/ObjC/Pods/Pods.xcodeproj/project.pbxproj +++ b/Examples/ObjC/Pods/Pods.xcodeproj/project.pbxproj @@ -7,25 +7,30 @@ objects = { /* Begin PBXBuildFile section */ - 0911EA5ED2189963215DF23015AA4CDD /* OHPathHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 60578CCDD4530A4BED0A62A91F928EDD /* OHPathHelpers.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; - 0EF8C5C7D55661254BC4B80B9D4D4382 /* OHHTTPStubs.h in Headers */ = {isa = PBXBuildFile; fileRef = AA89D7608EDC0885A0E4C97644724EA8 /* OHHTTPStubs.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1CEC5CA4BB814660BF231A8D2B086B8F /* OHHTTPStubsMethodSwizzling.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EAB72D4B5B0456406010DD7632D6EA6 /* OHHTTPStubsMethodSwizzling.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 335664F6B390F8D56CCBDFC24AA736BF /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DBA5794656CD6EAD5432F6E93991FC63 /* CFNetwork.framework */; }; - 46F2840BB28FD4C4B744374CCF13DA01 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C074C11AE6A5B57D6F593C07D4511E4 /* Foundation.framework */; }; - 543F2CD53EE37FCE716C09B1E84B85AC /* Compatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 7F77F7DD065DF4028B6930D855C6299D /* Compatibility.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 679F55432B27257C7EDC50F630832964 /* OHHTTPStubs-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E0AFE6357B1DD30F7A3A15249D0CDCC /* OHHTTPStubs-dummy.m */; }; - 69DDCA9E9C8308B5C8D6ACAA8085EE08 /* OHHTTPStubsResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 60A71BE0C9009D0D501ACF1A4C344298 /* OHHTTPStubsResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6E28B575D051A2A13B597CF5B7E26395 /* NSURLRequest+HTTPBodyTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = EDAA81D22C238067825DF739E45B5EEC /* NSURLRequest+HTTPBodyTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 74D4EB173DFB71808CE4F6629AA82983 /* NSURLRequest+HTTPBodyTesting.m in Sources */ = {isa = PBXBuildFile; fileRef = 42EFD56770D6AC1A24E2230F54BFD0E6 /* NSURLRequest+HTTPBodyTesting.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; - 7F83C318314B7CC1284A7F25B060A85B /* OHHTTPStubsMethodSwizzling.m in Sources */ = {isa = PBXBuildFile; fileRef = AF4E1C9F11CE5575B0988AA1E53C4B6B /* OHHTTPStubsMethodSwizzling.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; - 83A663929A2567B0C0E6D897F32C88C3 /* OHPathHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = A21B6E2BA61FA84089930C2A495A7AB7 /* OHPathHelpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 865B528C84559B2D4DB05679BEEAF5EA /* OHHTTPStubsResponse+JSON.h in Headers */ = {isa = PBXBuildFile; fileRef = 0D121EF23A0A9762C064653CEC3AD4D9 /* OHHTTPStubsResponse+JSON.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8794AD71F21CAE96779C539ED8587B81 /* OHHTTPStubs.m in Sources */ = {isa = PBXBuildFile; fileRef = 361C9B89713401B3A8E78E2FA693A68E /* OHHTTPStubs.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 131EC98C08EDEF11E36612D0A34AEEA8 /* NSURLRequest+HTTPBodyTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = EDAA81D22C238067825DF739E45B5EEC /* NSURLRequest+HTTPBodyTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 155287AAF13561187B75691BB2899E80 /* OHHTTPStubsMethodSwizzling.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EAB72D4B5B0456406010DD7632D6EA6 /* OHHTTPStubsMethodSwizzling.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 33D0D14B5DEEB826043D71A0F357EEE0 /* OHHTTPStubsProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = F98B7B835BA01FD3ADC63554E5748F22 /* OHHTTPStubsProtocol.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 39447EF9393A9E592148DF3BF054FA64 /* OHHTTPStubsProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F65CB88D6E801F14B5E4F3AEC915675 /* OHHTTPStubsProtocol.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 42F80305C30E2BD34790FF86A2C7310F /* Compatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F54C101689F556ED3478AFCCC7DDC3B /* Compatibility.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4D14B882A2311FE87CB0A6EA3DAAB2CB /* OHHTTPStubsResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = D4535519BFD7C6682B6A74929764B08C /* OHHTTPStubsResponse.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 702B50FD052A0E1B03067F2683DDA078 /* OHHTTPStubs+NSURLSessionConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 82DC75DF12DD823E60266EA14A6E40EF /* OHHTTPStubs+NSURLSessionConfiguration.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 8BFBCCBCBED4652A52EBC502EC7465B7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72913984B3E4B2AD01F71E405D688036 /* Foundation.framework */; }; + 9A749E05382F1A946488852DFDEED5CA /* OHHTTPStubs.m in Sources */ = {isa = PBXBuildFile; fileRef = 27981171BE0142CA850C69238ECABEAA /* OHHTTPStubs.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + B1A250ECCD035CED95B4A16FF6940A72 /* OHHTTPStubsMethodSwizzling.m in Sources */ = {isa = PBXBuildFile; fileRef = AF4E1C9F11CE5575B0988AA1E53C4B6B /* OHHTTPStubsMethodSwizzling.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + B2DC5356DFABD1EDDE649990F776A6C3 /* OHHTTPStubs-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E0AFE6357B1DD30F7A3A15249D0CDCC /* OHHTTPStubs-dummy.m */; }; + B6F6EF5247885A34EC52E06345C9A91B /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F46EFC5CDAF57A92A7B136FFD3525675 /* CFNetwork.framework */; }; + BA2992E54B5BFB35EE9A4D5CD5577D37 /* OHHTTPStubsResponse+JSON.h in Headers */ = {isa = PBXBuildFile; fileRef = 0D121EF23A0A9762C064653CEC3AD4D9 /* OHHTTPStubsResponse+JSON.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BFD3E7BBF85F4F44755FDF795FAAA610 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72913984B3E4B2AD01F71E405D688036 /* Foundation.framework */; }; + C99779E202B7F044FA51899BD70F4EB4 /* OHHTTPStubsResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 8294685CFD61D160B231ED861197C633 /* OHHTTPStubsResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + CAFE90A23392B51E52F473835E5E69F7 /* NSURLRequest+HTTPBodyTesting.m in Sources */ = {isa = PBXBuildFile; fileRef = 42EFD56770D6AC1A24E2230F54BFD0E6 /* NSURLRequest+HTTPBodyTesting.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + CCAE5C92792D0EB3147492C3B83034B0 /* OHHTTPStubs.h in Headers */ = {isa = PBXBuildFile; fileRef = F78FF46C3D6FCF634FDC338D97A43DEF /* OHHTTPStubs.h */; settings = {ATTRIBUTES = (Public, ); }; }; + CF55B37F7E93180430185475D54FA3DF /* OHHTTPStubsTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AB8E3E7BDAE10CEB93DA271ACD25883 /* OHHTTPStubsTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3BDDAB1F394C315072820789C548A09 /* OHHTTPStubsResponse+JSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 372B4244CD71926F86C9DEAE8273DF6D /* OHHTTPStubsResponse+JSON.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; D48FA07EBA1C05DCA28AD8365DB896E5 /* Pods-OHHTTPStubsDemo-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 881BD047298E69AABF0769517AD89923 /* Pods-OHHTTPStubsDemo-dummy.m */; }; - D8E3DDD5DFD313929CC131EFB7336539 /* OHHTTPStubsResponse+JSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 372B4244CD71926F86C9DEAE8273DF6D /* OHHTTPStubsResponse+JSON.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; - DD5CC615D6F46C1C11B376AAE88909C7 /* OHHTTPStubs+NSURLSessionConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 82DC75DF12DD823E60266EA14A6E40EF /* OHHTTPStubs+NSURLSessionConfiguration.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; - E0D5D77CFDFB2C3FC4206771C3E9BA8A /* OHHTTPStubsResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 72779C712A94AE779B3C264D685FBC8C /* OHHTTPStubsResponse.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; - F299D792D959B0A463A3B00C2D040293 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C074C11AE6A5B57D6F593C07D4511E4 /* Foundation.framework */; }; + E07B13A4E3616E8E3A280DA67F3178B6 /* OHPathHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = A21B6E2BA61FA84089930C2A495A7AB7 /* OHPathHelpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EA57BBEB67C03240BDAE259C97C7C1DB /* OHHTTPStubsDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = C0B5F1FE17ED3BE98ED5BB4655DDA34B /* OHHTTPStubsDescriptor.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + F971433E552B88AE38C02E0F9358A02A /* OHHTTPStubsDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 76BF73541A4F0BFF095369301F4880CB /* OHHTTPStubsDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; }; + FBEBEB8179C3443B0E81FD4E1834892D /* OHPathHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 60578CCDD4530A4BED0A62A91F928EDD /* OHPathHelpers.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -33,7 +38,7 @@ isa = PBXContainerItemProxy; containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; proxyType = 1; - remoteGlobalIDString = 0A578B91EB23BBD0EB78884A6FCB29D9; + remoteGlobalIDString = E39A9ECED32E05D4E03B40391F7F9E95; remoteInfo = OHHTTPStubs; }; /* End PBXContainerItemProxy section */ @@ -41,33 +46,38 @@ /* Begin PBXFileReference section */ 0D121EF23A0A9762C064653CEC3AD4D9 /* OHHTTPStubsResponse+JSON.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "OHHTTPStubsResponse+JSON.h"; sourceTree = ""; }; 1EAB72D4B5B0456406010DD7632D6EA6 /* OHHTTPStubsMethodSwizzling.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubsMethodSwizzling.h; sourceTree = ""; }; + 27981171BE0142CA850C69238ECABEAA /* OHHTTPStubs.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubs.m; sourceTree = ""; }; 2B8969779CE9B95D3BDDF85C5B1CEC60 /* Pods-OHHTTPStubsDemo-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-OHHTTPStubsDemo-frameworks.sh"; sourceTree = ""; }; 30ECE0F28462CF47B7057E3D31A28A73 /* Pods-OHHTTPStubsDemo-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-OHHTTPStubsDemo-resources.sh"; sourceTree = ""; }; - 361C9B89713401B3A8E78E2FA693A68E /* OHHTTPStubs.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubs.m; sourceTree = ""; }; 372B4244CD71926F86C9DEAE8273DF6D /* OHHTTPStubsResponse+JSON.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "OHHTTPStubsResponse+JSON.m"; sourceTree = ""; }; + 3F65CB88D6E801F14B5E4F3AEC915675 /* OHHTTPStubsProtocol.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubsProtocol.m; sourceTree = ""; }; 42EFD56770D6AC1A24E2230F54BFD0E6 /* NSURLRequest+HTTPBodyTesting.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "NSURLRequest+HTTPBodyTesting.m"; sourceTree = ""; }; 4C32685C73972E9A25B9A00BCA013BAF /* Pods-OHHTTPStubsDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-OHHTTPStubsDemo.release.xcconfig"; sourceTree = ""; }; - 5C074C11AE6A5B57D6F593C07D4511E4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 60578CCDD4530A4BED0A62A91F928EDD /* OHPathHelpers.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHPathHelpers.m; sourceTree = ""; }; - 60A71BE0C9009D0D501ACF1A4C344298 /* OHHTTPStubsResponse.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubsResponse.h; sourceTree = ""; }; 6E0AFE6357B1DD30F7A3A15249D0CDCC /* OHHTTPStubs-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "OHHTTPStubs-dummy.m"; sourceTree = ""; }; - 72779C712A94AE779B3C264D685FBC8C /* OHHTTPStubsResponse.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubsResponse.m; sourceTree = ""; }; + 6F54C101689F556ED3478AFCCC7DDC3B /* Compatibility.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = Compatibility.h; sourceTree = ""; }; + 72913984B3E4B2AD01F71E405D688036 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + 76BF73541A4F0BFF095369301F4880CB /* OHHTTPStubsDescriptor.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubsDescriptor.h; sourceTree = ""; }; 7A8F264AFD2F13955FCE232EC5F1DDED /* libOHHTTPStubs.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = libOHHTTPStubs.a; path = libOHHTTPStubs.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 7F77F7DD065DF4028B6930D855C6299D /* Compatibility.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = Compatibility.h; sourceTree = ""; }; + 8294685CFD61D160B231ED861197C633 /* OHHTTPStubsResponse.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubsResponse.h; sourceTree = ""; }; 82DC75DF12DD823E60266EA14A6E40EF /* OHHTTPStubs+NSURLSessionConfiguration.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "OHHTTPStubs+NSURLSessionConfiguration.m"; sourceTree = ""; }; 85B89F86F5655ACB606FDD90E571EDA5 /* libPods-OHHTTPStubsDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = "libPods-OHHTTPStubsDemo.a"; path = "libPods-OHHTTPStubsDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 881BD047298E69AABF0769517AD89923 /* Pods-OHHTTPStubsDemo-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-OHHTTPStubsDemo-dummy.m"; sourceTree = ""; }; + 8AB8E3E7BDAE10CEB93DA271ACD25883 /* OHHTTPStubsTypes.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubsTypes.h; sourceTree = ""; }; 932B6C2DE1D7F61A7B9238191B9730CF /* Pods-OHHTTPStubsDemo-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-OHHTTPStubsDemo-acknowledgements.markdown"; sourceTree = ""; }; 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 9FECCFC86E058236BE24A6460F44D824 /* Pods-OHHTTPStubsDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-OHHTTPStubsDemo.debug.xcconfig"; sourceTree = ""; }; A21B6E2BA61FA84089930C2A495A7AB7 /* OHPathHelpers.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHPathHelpers.h; sourceTree = ""; }; - AA89D7608EDC0885A0E4C97644724EA8 /* OHHTTPStubs.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubs.h; sourceTree = ""; }; AF4E1C9F11CE5575B0988AA1E53C4B6B /* OHHTTPStubsMethodSwizzling.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubsMethodSwizzling.m; sourceTree = ""; }; B98CA849E1036144879F7656743C7898 /* Pods-OHHTTPStubsDemo-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-OHHTTPStubsDemo-acknowledgements.plist"; sourceTree = ""; }; - DBA5794656CD6EAD5432F6E93991FC63 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/System/Library/Frameworks/CFNetwork.framework; sourceTree = DEVELOPER_DIR; }; + C0B5F1FE17ED3BE98ED5BB4655DDA34B /* OHHTTPStubsDescriptor.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubsDescriptor.m; sourceTree = ""; }; + D4535519BFD7C6682B6A74929764B08C /* OHHTTPStubsResponse.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubsResponse.m; sourceTree = ""; }; DE6E98C3714C9EF23870AEB316257B43 /* OHHTTPStubs-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "OHHTTPStubs-prefix.pch"; sourceTree = ""; }; EDAA81D22C238067825DF739E45B5EEC /* NSURLRequest+HTTPBodyTesting.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "NSURLRequest+HTTPBodyTesting.h"; sourceTree = ""; }; F44FCCEDDCDEC12345E4066BCDC783BA /* OHHTTPStubs.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = OHHTTPStubs.xcconfig; sourceTree = ""; }; + F46EFC5CDAF57A92A7B136FFD3525675 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/CFNetwork.framework; sourceTree = DEVELOPER_DIR; }; + F78FF46C3D6FCF634FDC338D97A43DEF /* OHHTTPStubs.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubs.h; sourceTree = ""; }; + F98B7B835BA01FD3ADC63554E5748F22 /* OHHTTPStubsProtocol.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubsProtocol.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -75,16 +85,16 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 46F2840BB28FD4C4B744374CCF13DA01 /* Foundation.framework in Frameworks */, + BFD3E7BBF85F4F44755FDF795FAAA610 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 7A8FF75CB5A3CD0E75894C629867B45D /* Frameworks */ = { + E578DD536259B4B8EA72296723A609BE /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 335664F6B390F8D56CCBDFC24AA736BF /* CFNetwork.framework in Frameworks */, - F299D792D959B0A463A3B00C2D040293 /* Foundation.framework in Frameworks */, + B6F6EF5247885A34EC52E06345C9A91B /* CFNetwork.framework in Frameworks */, + 8BFBCCBCBED4652A52EBC502EC7465B7 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -113,15 +123,6 @@ path = Sources; sourceTree = ""; }; - 07B963F066CF1C907024B787F3D5186F /* iOS */ = { - isa = PBXGroup; - children = ( - DBA5794656CD6EAD5432F6E93991FC63 /* CFNetwork.framework */, - 5C074C11AE6A5B57D6F593C07D4511E4 /* Foundation.framework */, - ); - name = iOS; - sourceTree = ""; - }; 0A7CE49963BD60C746C93E0ED8AB3F12 /* NSURLSession */ = { isa = PBXGroup; children = ( @@ -159,25 +160,21 @@ path = OHHTTPStubs; sourceTree = ""; }; - 433CD3331B6C3787F473C941B61FC68F /* Frameworks */ = { + 3DC75C8869B42AB93D04871325A0707E /* iOS */ = { isa = PBXGroup; children = ( - 07B963F066CF1C907024B787F3D5186F /* iOS */, + F46EFC5CDAF57A92A7B136FFD3525675 /* CFNetwork.framework */, + 72913984B3E4B2AD01F71E405D688036 /* Foundation.framework */, ); - name = Frameworks; + name = iOS; sourceTree = ""; }; - 53E0EF6F317ABA0DF1D236278FE7DC05 /* Sources */ = { + 433CD3331B6C3787F473C941B61FC68F /* Frameworks */ = { isa = PBXGroup; children = ( - 7F77F7DD065DF4028B6930D855C6299D /* Compatibility.h */, - AA89D7608EDC0885A0E4C97644724EA8 /* OHHTTPStubs.h */, - 361C9B89713401B3A8E78E2FA693A68E /* OHHTTPStubs.m */, - 60A71BE0C9009D0D501ACF1A4C344298 /* OHHTTPStubsResponse.h */, - 72779C712A94AE779B3C264D685FBC8C /* OHHTTPStubsResponse.m */, + 3DC75C8869B42AB93D04871325A0707E /* iOS */, ); - name = Sources; - path = Sources; + name = Frameworks; sourceTree = ""; }; 58226959435AC298E745FE2E9D50D242 /* OHHTTPStubs */ = { @@ -209,6 +206,15 @@ path = "Examples/ObjC/Pods/Target Support Files/OHHTTPStubs"; sourceTree = ""; }; + 6B247EB06320F98C27CFBBC0B82393ED /* OHHTTPStubs */ = { + isa = PBXGroup; + children = ( + C731F0D2107906C6269A2AC8FF7C2C0E /* Sources */, + ); + name = OHHTTPStubs; + path = OHHTTPStubs; + sourceTree = ""; + }; 7AE4944E27FA0C34AE06B78229D35432 /* Products */ = { isa = PBXGroup; children = ( @@ -232,7 +238,7 @@ 8CEE697E8E466481F529ECD7309DE4DE /* Core */ = { isa = PBXGroup; children = ( - D96BA07162FC31D1AFBADDFC36BFB7A5 /* OHHTTPStubs */, + 6B247EB06320F98C27CFBBC0B82393ED /* OHHTTPStubs */, ); name = Core; sourceTree = ""; @@ -269,6 +275,24 @@ path = "Target Support Files/Pods-OHHTTPStubsDemo"; sourceTree = ""; }; + C731F0D2107906C6269A2AC8FF7C2C0E /* Sources */ = { + isa = PBXGroup; + children = ( + 6F54C101689F556ED3478AFCCC7DDC3B /* Compatibility.h */, + F78FF46C3D6FCF634FDC338D97A43DEF /* OHHTTPStubs.h */, + 27981171BE0142CA850C69238ECABEAA /* OHHTTPStubs.m */, + 76BF73541A4F0BFF095369301F4880CB /* OHHTTPStubsDescriptor.h */, + C0B5F1FE17ED3BE98ED5BB4655DDA34B /* OHHTTPStubsDescriptor.m */, + F98B7B835BA01FD3ADC63554E5748F22 /* OHHTTPStubsProtocol.h */, + 3F65CB88D6E801F14B5E4F3AEC915675 /* OHHTTPStubsProtocol.m */, + 8294685CFD61D160B231ED861197C633 /* OHHTTPStubsResponse.h */, + D4535519BFD7C6682B6A74929764B08C /* OHHTTPStubsResponse.m */, + 8AB8E3E7BDAE10CEB93DA271ACD25883 /* OHHTTPStubsTypes.h */, + ); + name = Sources; + path = Sources; + sourceTree = ""; + }; CFD1C0DD4A0C994338D5EE09C71A9761 /* OHHTTPStubs */ = { isa = PBXGroup; children = ( @@ -282,15 +306,6 @@ path = ../../..; sourceTree = ""; }; - D96BA07162FC31D1AFBADDFC36BFB7A5 /* OHHTTPStubs */ = { - isa = PBXGroup; - children = ( - 53E0EF6F317ABA0DF1D236278FE7DC05 /* Sources */, - ); - name = OHHTTPStubs; - path = OHHTTPStubs; - sourceTree = ""; - }; F27255EB24C8CAFE3AFC2B5EE1665D8A /* JSON */ = { isa = PBXGroup; children = ( @@ -327,55 +342,58 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 72EF5C690397A6596F5B8EEC1E8C2CFB /* Headers */ = { + C222A25CCBB2DB4A5A149DFDB0EC8037 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 543F2CD53EE37FCE716C09B1E84B85AC /* Compatibility.h in Headers */, - 6E28B575D051A2A13B597CF5B7E26395 /* NSURLRequest+HTTPBodyTesting.h in Headers */, - 0EF8C5C7D55661254BC4B80B9D4D4382 /* OHHTTPStubs.h in Headers */, - 1CEC5CA4BB814660BF231A8D2B086B8F /* OHHTTPStubsMethodSwizzling.h in Headers */, - 865B528C84559B2D4DB05679BEEAF5EA /* OHHTTPStubsResponse+JSON.h in Headers */, - 69DDCA9E9C8308B5C8D6ACAA8085EE08 /* OHHTTPStubsResponse.h in Headers */, - 83A663929A2567B0C0E6D897F32C88C3 /* OHPathHelpers.h in Headers */, + 42F80305C30E2BD34790FF86A2C7310F /* Compatibility.h in Headers */, + 131EC98C08EDEF11E36612D0A34AEEA8 /* NSURLRequest+HTTPBodyTesting.h in Headers */, + CCAE5C92792D0EB3147492C3B83034B0 /* OHHTTPStubs.h in Headers */, + F971433E552B88AE38C02E0F9358A02A /* OHHTTPStubsDescriptor.h in Headers */, + 155287AAF13561187B75691BB2899E80 /* OHHTTPStubsMethodSwizzling.h in Headers */, + 33D0D14B5DEEB826043D71A0F357EEE0 /* OHHTTPStubsProtocol.h in Headers */, + BA2992E54B5BFB35EE9A4D5CD5577D37 /* OHHTTPStubsResponse+JSON.h in Headers */, + C99779E202B7F044FA51899BD70F4EB4 /* OHHTTPStubsResponse.h in Headers */, + CF55B37F7E93180430185475D54FA3DF /* OHHTTPStubsTypes.h in Headers */, + E07B13A4E3616E8E3A280DA67F3178B6 /* OHPathHelpers.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 0A578B91EB23BBD0EB78884A6FCB29D9 /* OHHTTPStubs */ = { + 5A702A0C396DEFB56278AC129AFA7F7A /* Pods-OHHTTPStubsDemo */ = { isa = PBXNativeTarget; - buildConfigurationList = 0C960ABD79C432B0E887DE3319B5604E /* Build configuration list for PBXNativeTarget "OHHTTPStubs" */; + buildConfigurationList = 4070FB2947C949B3A0EB73DA2F4157AB /* Build configuration list for PBXNativeTarget "Pods-OHHTTPStubsDemo" */; buildPhases = ( - E0DF25A8D942AE27DCC45F63BEB91D6E /* Sources */, - 7A8FF75CB5A3CD0E75894C629867B45D /* Frameworks */, - 72EF5C690397A6596F5B8EEC1E8C2CFB /* Headers */, + 3C65DE5033E1F00967BF0E157F491571 /* Sources */, + 1267DED2C313F83D6B26A666D33FAD01 /* Frameworks */, ); buildRules = ( ); dependencies = ( + EC553E552E1169D35B2386B86C99FC03 /* PBXTargetDependency */, ); - name = OHHTTPStubs; - productName = OHHTTPStubs; - productReference = 7A8F264AFD2F13955FCE232EC5F1DDED /* libOHHTTPStubs.a */; + name = "Pods-OHHTTPStubsDemo"; + productName = "Pods-OHHTTPStubsDemo"; + productReference = 85B89F86F5655ACB606FDD90E571EDA5 /* libPods-OHHTTPStubsDemo.a */; productType = "com.apple.product-type.library.static"; }; - 5A702A0C396DEFB56278AC129AFA7F7A /* Pods-OHHTTPStubsDemo */ = { + E39A9ECED32E05D4E03B40391F7F9E95 /* OHHTTPStubs */ = { isa = PBXNativeTarget; - buildConfigurationList = 4070FB2947C949B3A0EB73DA2F4157AB /* Build configuration list for PBXNativeTarget "Pods-OHHTTPStubsDemo" */; + buildConfigurationList = C0F3EC9827C8E3A1A5F23891D5299170 /* Build configuration list for PBXNativeTarget "OHHTTPStubs" */; buildPhases = ( - 3C65DE5033E1F00967BF0E157F491571 /* Sources */, - 1267DED2C313F83D6B26A666D33FAD01 /* Frameworks */, + 24AF04E14BF028C26B9356EC06D89E67 /* Sources */, + E578DD536259B4B8EA72296723A609BE /* Frameworks */, + C222A25CCBB2DB4A5A149DFDB0EC8037 /* Headers */, ); buildRules = ( ); dependencies = ( - EC553E552E1169D35B2386B86C99FC03 /* PBXTargetDependency */, ); - name = "Pods-OHHTTPStubsDemo"; - productName = "Pods-OHHTTPStubsDemo"; - productReference = 85B89F86F5655ACB606FDD90E571EDA5 /* libPods-OHHTTPStubsDemo.a */; + name = OHHTTPStubs; + productName = OHHTTPStubs; + productReference = 7A8F264AFD2F13955FCE232EC5F1DDED /* libOHHTTPStubs.a */; productType = "com.apple.product-type.library.static"; }; /* End PBXNativeTarget section */ @@ -384,7 +402,7 @@ D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0730; + LastSwiftUpdateCheck = 0830; LastUpgradeCheck = 0700; }; buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; @@ -399,33 +417,35 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 0A578B91EB23BBD0EB78884A6FCB29D9 /* OHHTTPStubs */, + E39A9ECED32E05D4E03B40391F7F9E95 /* OHHTTPStubs */, 5A702A0C396DEFB56278AC129AFA7F7A /* Pods-OHHTTPStubsDemo */, ); }; /* End PBXProject section */ /* Begin PBXSourcesBuildPhase section */ - 3C65DE5033E1F00967BF0E157F491571 /* Sources */ = { + 24AF04E14BF028C26B9356EC06D89E67 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D48FA07EBA1C05DCA28AD8365DB896E5 /* Pods-OHHTTPStubsDemo-dummy.m in Sources */, + CAFE90A23392B51E52F473835E5E69F7 /* NSURLRequest+HTTPBodyTesting.m in Sources */, + 702B50FD052A0E1B03067F2683DDA078 /* OHHTTPStubs+NSURLSessionConfiguration.m in Sources */, + B2DC5356DFABD1EDDE649990F776A6C3 /* OHHTTPStubs-dummy.m in Sources */, + 9A749E05382F1A946488852DFDEED5CA /* OHHTTPStubs.m in Sources */, + EA57BBEB67C03240BDAE259C97C7C1DB /* OHHTTPStubsDescriptor.m in Sources */, + B1A250ECCD035CED95B4A16FF6940A72 /* OHHTTPStubsMethodSwizzling.m in Sources */, + 39447EF9393A9E592148DF3BF054FA64 /* OHHTTPStubsProtocol.m in Sources */, + D3BDDAB1F394C315072820789C548A09 /* OHHTTPStubsResponse+JSON.m in Sources */, + 4D14B882A2311FE87CB0A6EA3DAAB2CB /* OHHTTPStubsResponse.m in Sources */, + FBEBEB8179C3443B0E81FD4E1834892D /* OHPathHelpers.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - E0DF25A8D942AE27DCC45F63BEB91D6E /* Sources */ = { + 3C65DE5033E1F00967BF0E157F491571 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 74D4EB173DFB71808CE4F6629AA82983 /* NSURLRequest+HTTPBodyTesting.m in Sources */, - DD5CC615D6F46C1C11B376AAE88909C7 /* OHHTTPStubs+NSURLSessionConfiguration.m in Sources */, - 679F55432B27257C7EDC50F630832964 /* OHHTTPStubs-dummy.m in Sources */, - 8794AD71F21CAE96779C539ED8587B81 /* OHHTTPStubs.m in Sources */, - 7F83C318314B7CC1284A7F25B060A85B /* OHHTTPStubsMethodSwizzling.m in Sources */, - D8E3DDD5DFD313929CC131EFB7336539 /* OHHTTPStubsResponse+JSON.m in Sources */, - E0D5D77CFDFB2C3FC4206771C3E9BA8A /* OHHTTPStubsResponse.m in Sources */, - 0911EA5ED2189963215DF23015AA4CDD /* OHPathHelpers.m in Sources */, + D48FA07EBA1C05DCA28AD8365DB896E5 /* Pods-OHHTTPStubsDemo-dummy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -435,12 +455,35 @@ EC553E552E1169D35B2386B86C99FC03 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = OHHTTPStubs; - target = 0A578B91EB23BBD0EB78884A6FCB29D9 /* OHHTTPStubs */; + target = E39A9ECED32E05D4E03B40391F7F9E95 /* OHHTTPStubs */; targetProxy = 4F8DBFC5BCBA28D4B8B01093E8C15CCA /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 29AA1881D9532C218B85DED830798D41 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F44FCCEDDCDEC12345E4066BCDC783BA /* OHHTTPStubs.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/OHHTTPStubs/OHHTTPStubs-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRIVATE_HEADERS_FOLDER_PATH = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Release; + }; 3FBA2AF953815D5CA71B508ED889CFE8 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 4C32685C73972E9A25B9A00BCA013BAF /* Pods-OHHTTPStubsDemo.release.xcconfig */; @@ -464,9 +507,9 @@ }; name = Release; }; - 9782C63A64D34AB0C18894945E18CF73 /* Debug */ = { + 55825E2172845015BADEDEA54B3F7290 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9FECCFC86E058236BE24A6460F44D824 /* Pods-OHHTTPStubsDemo.debug.xcconfig */; + baseConfigurationReference = F44FCCEDDCDEC12345E4066BCDC783BA /* OHHTTPStubs.xcconfig */; buildSettings = { "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -474,24 +517,25 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - MACH_O_TYPE = staticlib; + GCC_PREFIX_HEADER = "Target Support Files/OHHTTPStubs/OHHTTPStubs-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; MTL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRIVATE_HEADERS_FOLDER_PATH = ""; PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; }; name = Debug; }; - B569ECED6DF5EC7ABDDF8C8957E26574 /* Release */ = { + 8B16B17393C067E32CCA6BFB6CB86B2B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -499,20 +543,27 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGNING_REQUIRED = NO; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; + COPY_PHASE_STRIP = NO; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( - "POD_CONFIGURATION_RELEASE=1", + "POD_CONFIGURATION_DEBUG=1", + "DEBUG=1", "$(inherited)", ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -520,16 +571,16 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 6.0; + ONLY_ACTIVE_ARCH = YES; PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; STRIP_INSTALLED_PRODUCT = NO; SYMROOT = "${SRCROOT}/../build"; - VALIDATE_PRODUCT = YES; }; - name = Release; + name = Debug; }; - BAD3893840497A2DDBBC4506AA546163 /* Debug */ = { + 9782C63A64D34AB0C18894945E18CF73 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = F44FCCEDDCDEC12345E4066BCDC783BA /* OHHTTPStubs.xcconfig */; + baseConfigurationReference = 9FECCFC86E058236BE24A6460F44D824 /* Pods-OHHTTPStubsDemo.debug.xcconfig */; buildSettings = { "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -537,47 +588,25 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/OHHTTPStubs/OHHTTPStubs-prefix.pch"; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + MACH_O_TYPE = staticlib; MTL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; - PRIVATE_HEADERS_FOLDER_PATH = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; }; name = Debug; }; - BBC89F25C431280B80907BEBF7F312AE /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = F44FCCEDDCDEC12345E4066BCDC783BA /* OHHTTPStubs.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/OHHTTPStubs/OHHTTPStubs-prefix.pch"; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PRIVATE_HEADERS_FOLDER_PATH = ""; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = ""; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - }; - name = Release; - }; - FD5B3B1E89981BCDBC5C396B164D3C37 /* Debug */ = { + A809BE8D78489167E81F4DC31B6EED6D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -585,24 +614,23 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGNING_REQUIRED = NO; - COPY_PHASE_STRIP = NO; - ENABLE_TESTABILITY = YES; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( - "POD_CONFIGURATION_DEBUG=1", - "DEBUG=1", + "POD_CONFIGURATION_RELEASE=1", "$(inherited)", ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -610,39 +638,39 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 6.0; - ONLY_ACTIVE_ARCH = YES; PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; STRIP_INSTALLED_PRODUCT = NO; SYMROOT = "${SRCROOT}/../build"; + VALIDATE_PRODUCT = YES; }; - name = Debug; + name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 0C960ABD79C432B0E887DE3319B5604E /* Build configuration list for PBXNativeTarget "OHHTTPStubs" */ = { + 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { isa = XCConfigurationList; buildConfigurations = ( - BAD3893840497A2DDBBC4506AA546163 /* Debug */, - BBC89F25C431280B80907BEBF7F312AE /* Release */, + 8B16B17393C067E32CCA6BFB6CB86B2B /* Debug */, + A809BE8D78489167E81F4DC31B6EED6D /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { + 4070FB2947C949B3A0EB73DA2F4157AB /* Build configuration list for PBXNativeTarget "Pods-OHHTTPStubsDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( - FD5B3B1E89981BCDBC5C396B164D3C37 /* Debug */, - B569ECED6DF5EC7ABDDF8C8957E26574 /* Release */, + 9782C63A64D34AB0C18894945E18CF73 /* Debug */, + 3FBA2AF953815D5CA71B508ED889CFE8 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 4070FB2947C949B3A0EB73DA2F4157AB /* Build configuration list for PBXNativeTarget "Pods-OHHTTPStubsDemo" */ = { + C0F3EC9827C8E3A1A5F23891D5299170 /* Build configuration list for PBXNativeTarget "OHHTTPStubs" */ = { isa = XCConfigurationList; buildConfigurations = ( - 9782C63A64D34AB0C18894945E18CF73 /* Debug */, - 3FBA2AF953815D5CA71B508ED889CFE8 /* Release */, + 55825E2172845015BADEDEA54B3F7290 /* Debug */, + 29AA1881D9532C218B85DED830798D41 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/Examples/Swift/Podfile.lock b/Examples/Swift/Podfile.lock index fc62cd7b..6561d3df 100644 --- a/Examples/Swift/Podfile.lock +++ b/Examples/Swift/Podfile.lock @@ -21,10 +21,10 @@ DEPENDENCIES: EXTERNAL SOURCES: OHHTTPStubs: - :path: "../.." + :path: ../.. SPEC CHECKSUMS: - OHHTTPStubs: dbe7fc78b805b075ff74bb20922854d0dca8679b + OHHTTPStubs: 5a78fe08e8f13065df05203a1f8f56b4a243ee17 PODFILE CHECKSUM: 7da7c441ea9ff6f06b633c908b7a7294805f5602 diff --git a/Examples/Swift/Pods/Local Podspecs/OHHTTPStubs.podspec.json b/Examples/Swift/Pods/Local Podspecs/OHHTTPStubs.podspec.json index b4b1a131..2bf7f5e3 100644 --- a/Examples/Swift/Pods/Local Podspecs/OHHTTPStubs.podspec.json +++ b/Examples/Swift/Pods/Local Podspecs/OHHTTPStubs.podspec.json @@ -45,7 +45,11 @@ { "name": "Core", "source_files": "OHHTTPStubs/Sources/*.{h,m}", - "public_header_files": "OHHTTPStubs/Sources/*.h" + "public_header_files": "OHHTTPStubs/Sources/*.h", + "private_header_files": [ + "OHHTTPStubs/Sources/OHHTTPStubsDescriptor.h", + "OHHTTPStubs/Sources/OHHTTPStubsProtocol.h" + ] }, { "name": "NSURLSession", diff --git a/Examples/Swift/Pods/Manifest.lock b/Examples/Swift/Pods/Manifest.lock index fc62cd7b..6561d3df 100644 --- a/Examples/Swift/Pods/Manifest.lock +++ b/Examples/Swift/Pods/Manifest.lock @@ -21,10 +21,10 @@ DEPENDENCIES: EXTERNAL SOURCES: OHHTTPStubs: - :path: "../.." + :path: ../.. SPEC CHECKSUMS: - OHHTTPStubs: dbe7fc78b805b075ff74bb20922854d0dca8679b + OHHTTPStubs: 5a78fe08e8f13065df05203a1f8f56b4a243ee17 PODFILE CHECKSUM: 7da7c441ea9ff6f06b633c908b7a7294805f5602 diff --git a/Examples/Swift/Pods/Pods.xcodeproj/project.pbxproj b/Examples/Swift/Pods/Pods.xcodeproj/project.pbxproj index 6b2758cf..d1904762 100644 --- a/Examples/Swift/Pods/Pods.xcodeproj/project.pbxproj +++ b/Examples/Swift/Pods/Pods.xcodeproj/project.pbxproj @@ -7,28 +7,33 @@ objects = { /* Begin PBXBuildFile section */ - 00A3C09C880C6A237F305CC79C260742 /* NSURLRequest+HTTPBodyTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = 13C7BA92F4EDA50F712E517B6BAE2089 /* NSURLRequest+HTTPBodyTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 0A99967FC0ADF751636D19A03423D131 /* OHHTTPStubsResponse+JSON.h in Headers */ = {isa = PBXBuildFile; fileRef = 1B2EE4021E9783508809182DA0EBB0BB /* OHHTTPStubsResponse+JSON.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 0DFF736AB00087E95576F72E7FB07AC8 /* OHHTTPStubs-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 0022B34EC81389BF2202E89A751DC1DF /* OHHTTPStubs-dummy.m */; }; + 16690F20DEDF20A831E96B7CDCE0575F /* OHHTTPStubsResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = C9A01513B7D22EDFEA9A11EC827F5B56 /* OHHTTPStubsResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1FF06A47389B7B0181E1A1D3AB9C04D9 /* OHHTTPStubsMethodSwizzling.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C4C300CEF4D5F37DD1B4B5FE5A692E /* OHHTTPStubsMethodSwizzling.h */; settings = {ATTRIBUTES = (Private, ); }; }; 22EBC3EA9D49F603A4B51551108803F4 /* Pods-OHHTTPStubsDemo-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C552F3BC0CBE950E3C7104DC00BB16B /* Pods-OHHTTPStubsDemo-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 27E98DC6DD56F470AD820D47F257A1A6 /* OHHTTPStubs.m in Sources */ = {isa = PBXBuildFile; fileRef = 23AD7D9A87278BA70A485F27AA3109D3 /* OHHTTPStubs.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; - 294553EE0D798B0B7220BF3AD4F200DF /* OHHTTPStubsSwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97DDE4B6F42C6BF5ACADD91DB5CF8EDA /* OHHTTPStubsSwift.swift */; }; - 2B5C4A6FB99B6CAC2D4BA85DAF91FDEA /* OHHTTPStubs-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 0022B34EC81389BF2202E89A751DC1DF /* OHHTTPStubs-dummy.m */; }; - 33226F1EF9FD973442E8DA63DC61E169 /* OHHTTPStubs-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 574AAE6C9F943143E09E17B15DBDCBDE /* OHHTTPStubs-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 60BE7023AF5678BADF6825229A748CCA /* OHHTTPStubsResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = D26C3F5FFF0E3FE1EBACE25D14A0B916 /* OHHTTPStubsResponse.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; - 908C174297315DFB382C4F3BCA828627 /* OHHTTPStubsResponse+JSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BBD005FCBFB84141551032B2214F1FE /* OHHTTPStubsResponse+JSON.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; - 997FBEE261F23A9FFAC71AF836166488 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C074C11AE6A5B57D6F593C07D4511E4 /* Foundation.framework */; }; - A6D958FC0D5892BED0B1FF27D8DB5694 /* OHHTTPStubs+NSURLSessionConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = FB9EC04A7F2D6ECE8A2CC91264C3A717 /* OHHTTPStubs+NSURLSessionConfiguration.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; - A6EE28EF5D6933C6A182203BC9C20BBF /* OHHTTPStubs.h in Headers */ = {isa = PBXBuildFile; fileRef = E33F6CB6CFA4603ED27AAFC6CA7CCD03 /* OHHTTPStubs.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B282319D0CF6CF46FF430EF4D78919AF /* OHPathHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = DCF83E9F29D519CDB1C87BCC4198000F /* OHPathHelpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B43DF950C82CC959A01F4CC06C540290 /* NSURLRequest+HTTPBodyTesting.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C10A61B95E41308700D8407627236D9 /* NSURLRequest+HTTPBodyTesting.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; - BAEB04641E54A923ACB6BCBCC1379582 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C074C11AE6A5B57D6F593C07D4511E4 /* Foundation.framework */; }; - C137CCA90B82D873524D5C00AA00BF14 /* Compatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D2E8468FB2F9A42167B37B888A9B18F /* Compatibility.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C2760026B0588FFF5D13DA017EE76583 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DBA5794656CD6EAD5432F6E93991FC63 /* CFNetwork.framework */; }; - D8DFE97639FB74453BBC78D7DAAB63F7 /* OHPathHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CCDA86260E893B6EB02FE5F79C2F83F /* OHPathHelpers.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 2B02121671A018EE23AD0030691C7B9F /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F46EFC5CDAF57A92A7B136FFD3525675 /* CFNetwork.framework */; }; + 376E7138929DCA9E40E78BC5C8F6AF4F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72913984B3E4B2AD01F71E405D688036 /* Foundation.framework */; }; + 38CFD88E2DF9D560F02BF68DFDAAC1AA /* OHHTTPStubsResponse+JSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BBD005FCBFB84141551032B2214F1FE /* OHHTTPStubsResponse+JSON.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 39E3E34CE2B0B3E33E4E222B7E6AAF7B /* OHHTTPStubsDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = E08AD0562034E3E6F1B8378B937FA362 /* OHHTTPStubsDescriptor.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 5674F99AA11DB55043362FF8B0A7A681 /* OHHTTPStubs+NSURLSessionConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = FB9EC04A7F2D6ECE8A2CC91264C3A717 /* OHHTTPStubs+NSURLSessionConfiguration.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 5780F913507604A309EC5643F20CF00D /* OHHTTPStubsMethodSwizzling.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB8E7E9D8D1C6E8480D89CBD998EAE5 /* OHHTTPStubsMethodSwizzling.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 58ECCFB1DD4C3FF2B5FAE6CA5BBA32FE /* OHHTTPStubsResponse+JSON.h in Headers */ = {isa = PBXBuildFile; fileRef = 1B2EE4021E9783508809182DA0EBB0BB /* OHHTTPStubsResponse+JSON.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 5C7101982CAAC3DF63C0A9315F6EF72C /* OHPathHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CCDA86260E893B6EB02FE5F79C2F83F /* OHPathHelpers.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 5FC2FFFE2B240E7244946CCC9397F4E4 /* OHPathHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = DCF83E9F29D519CDB1C87BCC4198000F /* OHPathHelpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 620B2C7CAD9397CEA7FD4412E02AFBC0 /* OHHTTPStubs.h in Headers */ = {isa = PBXBuildFile; fileRef = C9B1DF5B03D425545505C0F9BA00CA46 /* OHHTTPStubs.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 67619778CDD2F000EB9D64119B2B8957 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72913984B3E4B2AD01F71E405D688036 /* Foundation.framework */; }; + 6971B08549D13354BE9F024F14D528C3 /* OHHTTPStubs-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 574AAE6C9F943143E09E17B15DBDCBDE /* OHHTTPStubs-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 8B7BF652E6CD4DB85087D3FA15F83D41 /* OHHTTPStubsProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BEB63C47B063AF10EE5E3B410C1F6BF /* OHHTTPStubsProtocol.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 8DA9BA3240AB05AF1B21FC9B090E89F4 /* OHHTTPStubsSwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97DDE4B6F42C6BF5ACADD91DB5CF8EDA /* OHHTTPStubsSwift.swift */; }; + 912A4153EF64F50DDE536C34DB39F8B4 /* OHHTTPStubsTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 86925408E90806A2E5F21FB1CF175851 /* OHHTTPStubsTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BE9302235C52E7EB7948964B1EC236C0 /* OHHTTPStubs.m in Sources */ = {isa = PBXBuildFile; fileRef = 7927B7F195BE29B4E072D4FE3603597C /* OHHTTPStubs.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + C841CA44C6D3C3932E153445A42C102E /* OHHTTPStubsProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = CE08788A5F97130401D91073E80F5E8F /* OHHTTPStubsProtocol.h */; settings = {ATTRIBUTES = (Private, ); }; }; + CDEA6B147923587159C4E18EFFDD7F40 /* OHHTTPStubsResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 7208CC17CAF43BE60807BB756DB50EC2 /* OHHTTPStubsResponse.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + CE85304C615654A55379A8257ED447AA /* NSURLRequest+HTTPBodyTesting.h in Headers */ = {isa = PBXBuildFile; fileRef = 13C7BA92F4EDA50F712E517B6BAE2089 /* NSURLRequest+HTTPBodyTesting.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D1697BF7331E34712CB48369F6ABA4F8 /* OHHTTPStubsDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0AEEBFFDE7D0836DBE790165443ED926 /* OHHTTPStubsDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; }; D993C4C9A14D2AAA90BDA42176B891EB /* Pods-OHHTTPStubsDemo-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3C2E9CDA5FCD95294B53D23EB5967A /* Pods-OHHTTPStubsDemo-dummy.m */; }; - E5E78C938C457F28754CA4F82230FC1D /* OHHTTPStubsMethodSwizzling.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C4C300CEF4D5F37DD1B4B5FE5A692E /* OHHTTPStubsMethodSwizzling.h */; settings = {ATTRIBUTES = (Private, ); }; }; - EB5EEEAEAF693A64F81FBB34BEEB8FF4 /* OHHTTPStubsResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 718522274D8F333877C51D4ED3C55B73 /* OHHTTPStubsResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - FE0EE9E83A093A95A959687BC65FC2C3 /* OHHTTPStubsMethodSwizzling.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB8E7E9D8D1C6E8480D89CBD998EAE5 /* OHHTTPStubsMethodSwizzling.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + F1636D6F5C70B216F7A7D05EB2D11107 /* Compatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = ED1A9A880A7DCC5E428CCDCFD5A6069E /* Compatibility.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FAFB126969B43E3DB082A94F57F623C1 /* NSURLRequest+HTTPBodyTesting.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C10A61B95E41308700D8407627236D9 /* NSURLRequest+HTTPBodyTesting.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -36,13 +41,15 @@ isa = PBXContainerItemProxy; containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; proxyType = 1; - remoteGlobalIDString = 748F1C7F61D88F3FB355A8E829489671; + remoteGlobalIDString = 43DF549FDD179C35F50D1ED98490A019; remoteInfo = OHHTTPStubs; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 0022B34EC81389BF2202E89A751DC1DF /* OHHTTPStubs-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "OHHTTPStubs-dummy.m"; sourceTree = ""; }; + 0AEEBFFDE7D0836DBE790165443ED926 /* OHHTTPStubsDescriptor.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubsDescriptor.h; sourceTree = ""; }; + 0BEB63C47B063AF10EE5E3B410C1F6BF /* OHHTTPStubsProtocol.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubsProtocol.m; sourceTree = ""; }; 0DCBA212DCE5B7F0563BFEA5B41FF623 /* OHHTTPStubs.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = OHHTTPStubs.framework; path = OHHTTPStubs.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 10F38ED31DBDC9666D60AB76F298D245 /* Pods-OHHTTPStubsDemo-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-OHHTTPStubsDemo-resources.sh"; sourceTree = ""; }; 13C7BA92F4EDA50F712E517B6BAE2089 /* NSURLRequest+HTTPBodyTesting.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "NSURLRequest+HTTPBodyTesting.h"; sourceTree = ""; }; @@ -50,19 +57,19 @@ 1B2EE4021E9783508809182DA0EBB0BB /* OHHTTPStubsResponse+JSON.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "OHHTTPStubsResponse+JSON.h"; sourceTree = ""; }; 1C552F3BC0CBE950E3C7104DC00BB16B /* Pods-OHHTTPStubsDemo-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-OHHTTPStubsDemo-umbrella.h"; sourceTree = ""; }; 1CCDA86260E893B6EB02FE5F79C2F83F /* OHPathHelpers.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHPathHelpers.m; sourceTree = ""; }; - 23AD7D9A87278BA70A485F27AA3109D3 /* OHHTTPStubs.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubs.m; sourceTree = ""; }; 337132FA298B4BCF0C4F7F3205D9AE0E /* OHHTTPStubs-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "OHHTTPStubs-prefix.pch"; sourceTree = ""; }; 427047E9F98783D101A013CAA96B50F5 /* Pods-OHHTTPStubsDemo.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-OHHTTPStubsDemo.modulemap"; sourceTree = ""; }; - 4D2E8468FB2F9A42167B37B888A9B18F /* Compatibility.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = Compatibility.h; sourceTree = ""; }; 5105B5329D94771AC975ECA417AE88A8 /* Pods-OHHTTPStubsDemo-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-OHHTTPStubsDemo-acknowledgements.markdown"; sourceTree = ""; }; 574AAE6C9F943143E09E17B15DBDCBDE /* OHHTTPStubs-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "OHHTTPStubs-umbrella.h"; sourceTree = ""; }; 5BBD005FCBFB84141551032B2214F1FE /* OHHTTPStubsResponse+JSON.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "OHHTTPStubsResponse+JSON.m"; sourceTree = ""; }; - 5C074C11AE6A5B57D6F593C07D4511E4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 5C10A61B95E41308700D8407627236D9 /* NSURLRequest+HTTPBodyTesting.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "NSURLRequest+HTTPBodyTesting.m"; sourceTree = ""; }; 5E3C2E9CDA5FCD95294B53D23EB5967A /* Pods-OHHTTPStubsDemo-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-OHHTTPStubsDemo-dummy.m"; sourceTree = ""; }; 6F3D3EBB22838E0186A202BB4AFCA73F /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 718522274D8F333877C51D4ED3C55B73 /* OHHTTPStubsResponse.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubsResponse.h; sourceTree = ""; }; + 7208CC17CAF43BE60807BB756DB50EC2 /* OHHTTPStubsResponse.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubsResponse.m; sourceTree = ""; }; + 72913984B3E4B2AD01F71E405D688036 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + 7927B7F195BE29B4E072D4FE3603597C /* OHHTTPStubs.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubs.m; sourceTree = ""; }; 8538626B48EE5872A21F58430C92C3DD /* Pods-OHHTTPStubsDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-OHHTTPStubsDemo.release.xcconfig"; sourceTree = ""; }; + 86925408E90806A2E5F21FB1CF175851 /* OHHTTPStubsTypes.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubsTypes.h; sourceTree = ""; }; 8738CED8CB17739066C976AAEB639DDC /* Pods_OHHTTPStubsDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_OHHTTPStubsDemo.framework; path = "Pods-OHHTTPStubsDemo.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; 88609D44020D26851691622530943039 /* Pods-OHHTTPStubsDemo-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-OHHTTPStubsDemo-frameworks.sh"; sourceTree = ""; }; 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; @@ -70,12 +77,15 @@ A0ED295B9252284A28D4040EB5E4DDA1 /* Pods-OHHTTPStubsDemo-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-OHHTTPStubsDemo-acknowledgements.plist"; sourceTree = ""; }; A3D0167CCCDFB47EA696D4C4F91B8248 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; BECDE9FF20B044F411F2FDD192405ED1 /* OHHTTPStubs.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = OHHTTPStubs.modulemap; sourceTree = ""; }; - D26C3F5FFF0E3FE1EBACE25D14A0B916 /* OHHTTPStubsResponse.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubsResponse.m; sourceTree = ""; }; - DBA5794656CD6EAD5432F6E93991FC63 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/System/Library/Frameworks/CFNetwork.framework; sourceTree = DEVELOPER_DIR; }; + C9A01513B7D22EDFEA9A11EC827F5B56 /* OHHTTPStubsResponse.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubsResponse.h; sourceTree = ""; }; + C9B1DF5B03D425545505C0F9BA00CA46 /* OHHTTPStubs.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubs.h; sourceTree = ""; }; + CE08788A5F97130401D91073E80F5E8F /* OHHTTPStubsProtocol.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubsProtocol.h; sourceTree = ""; }; DCF83E9F29D519CDB1C87BCC4198000F /* OHPathHelpers.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHPathHelpers.h; sourceTree = ""; }; - E33F6CB6CFA4603ED27AAFC6CA7CCD03 /* OHHTTPStubs.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubs.h; sourceTree = ""; }; + E08AD0562034E3E6F1B8378B937FA362 /* OHHTTPStubsDescriptor.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubsDescriptor.m; sourceTree = ""; }; E56DE22A0F090D8C9CBFEA942214081F /* OHHTTPStubs.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = OHHTTPStubs.xcconfig; sourceTree = ""; }; E82F2FA8F4A57A7D1D3F5FEDF1349021 /* Pods-OHHTTPStubsDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-OHHTTPStubsDemo.debug.xcconfig"; sourceTree = ""; }; + ED1A9A880A7DCC5E428CCDCFD5A6069E /* Compatibility.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = Compatibility.h; sourceTree = ""; }; + F46EFC5CDAF57A92A7B136FFD3525675 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/CFNetwork.framework; sourceTree = DEVELOPER_DIR; }; FAB8E7E9D8D1C6E8480D89CBD998EAE5 /* OHHTTPStubsMethodSwizzling.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubsMethodSwizzling.m; sourceTree = ""; }; FB9EC04A7F2D6ECE8A2CC91264C3A717 /* OHHTTPStubs+NSURLSessionConfiguration.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "OHHTTPStubs+NSURLSessionConfiguration.m"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -85,48 +95,35 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 997FBEE261F23A9FFAC71AF836166488 /* Foundation.framework in Frameworks */, + 67619778CDD2F000EB9D64119B2B8957 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 64CBC846CD2C0E66734972089F31261F /* Frameworks */ = { + C4AACB0F4095937FC31FFD03C41A90C9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C2760026B0588FFF5D13DA017EE76583 /* CFNetwork.framework in Frameworks */, - BAEB04641E54A923ACB6BCBCC1379582 /* Foundation.framework in Frameworks */, + 2B02121671A018EE23AD0030691C7B9F /* CFNetwork.framework in Frameworks */, + 376E7138929DCA9E40E78BC5C8F6AF4F /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 022D74742AD48E792C43F7773F84C7B6 /* Sources */ = { - isa = PBXGroup; - children = ( - 4D2E8468FB2F9A42167B37B888A9B18F /* Compatibility.h */, - E33F6CB6CFA4603ED27AAFC6CA7CCD03 /* OHHTTPStubs.h */, - 23AD7D9A87278BA70A485F27AA3109D3 /* OHHTTPStubs.m */, - 718522274D8F333877C51D4ED3C55B73 /* OHHTTPStubsResponse.h */, - D26C3F5FFF0E3FE1EBACE25D14A0B916 /* OHHTTPStubsResponse.m */, - ); - name = Sources; - path = Sources; - sourceTree = ""; - }; - 07B963F066CF1C907024B787F3D5186F /* iOS */ = { + 0A446A7A45EAC328B63B69A5FEC6643F /* OHHTTPStubs */ = { isa = PBXGroup; children = ( - DBA5794656CD6EAD5432F6E93991FC63 /* CFNetwork.framework */, - 5C074C11AE6A5B57D6F593C07D4511E4 /* Foundation.framework */, + CF44B4777E40911E0A17721594AA60CF /* Sources */, ); - name = iOS; + name = OHHTTPStubs; + path = OHHTTPStubs; sourceTree = ""; }; - 0A446A7A45EAC328B63B69A5FEC6643F /* OHHTTPStubs */ = { + 0E452C6191132B194A69D48855F0F267 /* OHHTTPStubs */ = { isa = PBXGroup; children = ( - CF44B4777E40911E0A17721594AA60CF /* Sources */, + 8C82BAD66A912DC2131642A93B82680D /* Sources */, ); name = OHHTTPStubs; path = OHHTTPStubs; @@ -187,15 +184,6 @@ path = OHHTTPStubs; sourceTree = ""; }; - 28E98461D6B443CC156F7A650E8B7542 /* OHHTTPStubs */ = { - isa = PBXGroup; - children = ( - 022D74742AD48E792C43F7773F84C7B6 /* Sources */, - ); - name = OHHTTPStubs; - path = OHHTTPStubs; - sourceTree = ""; - }; 354772680BBDBEF024E45ED3AF266621 /* NSURLSession */ = { isa = PBXGroup; children = ( @@ -235,6 +223,15 @@ path = NSURLSession; sourceTree = ""; }; + 3DC75C8869B42AB93D04871325A0707E /* iOS */ = { + isa = PBXGroup; + children = ( + F46EFC5CDAF57A92A7B136FFD3525675 /* CFNetwork.framework */, + 72913984B3E4B2AD01F71E405D688036 /* Foundation.framework */, + ); + name = iOS; + sourceTree = ""; + }; 3E5DDBFAFBA9744827CBC470B0D77931 /* Sources */ = { isa = PBXGroup; children = ( @@ -255,7 +252,7 @@ 433CD3331B6C3787F473C941B61FC68F /* Frameworks */ = { isa = PBXGroup; children = ( - 07B963F066CF1C907024B787F3D5186F /* iOS */, + 3DC75C8869B42AB93D04871325A0707E /* iOS */, ); name = Frameworks; sourceTree = ""; @@ -297,7 +294,7 @@ 66E91CCC34192B225BE8497A3374E401 /* Core */ = { isa = PBXGroup; children = ( - 28E98461D6B443CC156F7A650E8B7542 /* OHHTTPStubs */, + 0E452C6191132B194A69D48855F0F267 /* OHHTTPStubs */, ); name = Core; sourceTree = ""; @@ -332,6 +329,24 @@ ); sourceTree = ""; }; + 8C82BAD66A912DC2131642A93B82680D /* Sources */ = { + isa = PBXGroup; + children = ( + ED1A9A880A7DCC5E428CCDCFD5A6069E /* Compatibility.h */, + C9B1DF5B03D425545505C0F9BA00CA46 /* OHHTTPStubs.h */, + 7927B7F195BE29B4E072D4FE3603597C /* OHHTTPStubs.m */, + 0AEEBFFDE7D0836DBE790165443ED926 /* OHHTTPStubsDescriptor.h */, + E08AD0562034E3E6F1B8378B937FA362 /* OHHTTPStubsDescriptor.m */, + CE08788A5F97130401D91073E80F5E8F /* OHHTTPStubsProtocol.h */, + 0BEB63C47B063AF10EE5E3B410C1F6BF /* OHHTTPStubsProtocol.m */, + C9A01513B7D22EDFEA9A11EC827F5B56 /* OHHTTPStubsResponse.h */, + 7208CC17CAF43BE60807BB756DB50EC2 /* OHHTTPStubsResponse.m */, + 86925408E90806A2E5F21FB1CF175851 /* OHHTTPStubsTypes.h */, + ); + name = Sources; + path = Sources; + sourceTree = ""; + }; A40BE4A8D7A32BD45D2DD703F8681F21 /* OHPathHelpers */ = { isa = PBXGroup; children = ( @@ -379,18 +394,21 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - A56D571C409DBDBFFEDBA0B642B32A34 /* Headers */ = { + C6EF6E0EE578E5A553CE9478C5806E2B /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - C137CCA90B82D873524D5C00AA00BF14 /* Compatibility.h in Headers */, - 00A3C09C880C6A237F305CC79C260742 /* NSURLRequest+HTTPBodyTesting.h in Headers */, - 33226F1EF9FD973442E8DA63DC61E169 /* OHHTTPStubs-umbrella.h in Headers */, - A6EE28EF5D6933C6A182203BC9C20BBF /* OHHTTPStubs.h in Headers */, - E5E78C938C457F28754CA4F82230FC1D /* OHHTTPStubsMethodSwizzling.h in Headers */, - 0A99967FC0ADF751636D19A03423D131 /* OHHTTPStubsResponse+JSON.h in Headers */, - EB5EEEAEAF693A64F81FBB34BEEB8FF4 /* OHHTTPStubsResponse.h in Headers */, - B282319D0CF6CF46FF430EF4D78919AF /* OHPathHelpers.h in Headers */, + F1636D6F5C70B216F7A7D05EB2D11107 /* Compatibility.h in Headers */, + CE85304C615654A55379A8257ED447AA /* NSURLRequest+HTTPBodyTesting.h in Headers */, + 6971B08549D13354BE9F024F14D528C3 /* OHHTTPStubs-umbrella.h in Headers */, + 620B2C7CAD9397CEA7FD4412E02AFBC0 /* OHHTTPStubs.h in Headers */, + D1697BF7331E34712CB48369F6ABA4F8 /* OHHTTPStubsDescriptor.h in Headers */, + 1FF06A47389B7B0181E1A1D3AB9C04D9 /* OHHTTPStubsMethodSwizzling.h in Headers */, + C841CA44C6D3C3932E153445A42C102E /* OHHTTPStubsProtocol.h in Headers */, + 58ECCFB1DD4C3FF2B5FAE6CA5BBA32FE /* OHHTTPStubsResponse+JSON.h in Headers */, + 16690F20DEDF20A831E96B7CDCE0575F /* OHHTTPStubsResponse.h in Headers */, + 912A4153EF64F50DDE536C34DB39F8B4 /* OHHTTPStubsTypes.h in Headers */, + 5FC2FFFE2B240E7244946CCC9397F4E4 /* OHPathHelpers.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -405,39 +423,39 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 4DAB16E5D4A9B995759E4E4E7B2E8992 /* Pods-OHHTTPStubsDemo */ = { + 43DF549FDD179C35F50D1ED98490A019 /* OHHTTPStubs */ = { isa = PBXNativeTarget; - buildConfigurationList = 17F022695A72ABD0379F85E26C02EC4F /* Build configuration list for PBXNativeTarget "Pods-OHHTTPStubsDemo" */; + buildConfigurationList = D391FFF705E294791BF3C9F36FD82D64 /* Build configuration list for PBXNativeTarget "OHHTTPStubs" */; buildPhases = ( - 1489AAB30E2CBD62D08135D7E43681FF /* Sources */, - 28BAC9844E44835196B4455523055D83 /* Frameworks */, - E38687C591F4AD866352444EC1B25EA3 /* Headers */, + 3979F59FC609AD486B1DD497386F276C /* Sources */, + C4AACB0F4095937FC31FFD03C41A90C9 /* Frameworks */, + C6EF6E0EE578E5A553CE9478C5806E2B /* Headers */, ); buildRules = ( ); dependencies = ( - EA00E4A7BAECB75DA0018817B800D1B2 /* PBXTargetDependency */, ); - name = "Pods-OHHTTPStubsDemo"; - productName = "Pods-OHHTTPStubsDemo"; - productReference = 8738CED8CB17739066C976AAEB639DDC /* Pods_OHHTTPStubsDemo.framework */; + name = OHHTTPStubs; + productName = OHHTTPStubs; + productReference = 0DCBA212DCE5B7F0563BFEA5B41FF623 /* OHHTTPStubs.framework */; productType = "com.apple.product-type.framework"; }; - 748F1C7F61D88F3FB355A8E829489671 /* OHHTTPStubs */ = { + 4DAB16E5D4A9B995759E4E4E7B2E8992 /* Pods-OHHTTPStubsDemo */ = { isa = PBXNativeTarget; - buildConfigurationList = C85E9BCC67642A6B5D72777C9A2EFC1C /* Build configuration list for PBXNativeTarget "OHHTTPStubs" */; + buildConfigurationList = 17F022695A72ABD0379F85E26C02EC4F /* Build configuration list for PBXNativeTarget "Pods-OHHTTPStubsDemo" */; buildPhases = ( - BDA322F9A3B29B31661AE13DB299100B /* Sources */, - 64CBC846CD2C0E66734972089F31261F /* Frameworks */, - A56D571C409DBDBFFEDBA0B642B32A34 /* Headers */, + 1489AAB30E2CBD62D08135D7E43681FF /* Sources */, + 28BAC9844E44835196B4455523055D83 /* Frameworks */, + E38687C591F4AD866352444EC1B25EA3 /* Headers */, ); buildRules = ( ); dependencies = ( + EA00E4A7BAECB75DA0018817B800D1B2 /* PBXTargetDependency */, ); - name = OHHTTPStubs; - productName = OHHTTPStubs; - productReference = 0DCBA212DCE5B7F0563BFEA5B41FF623 /* OHHTTPStubs.framework */; + name = "Pods-OHHTTPStubsDemo"; + productName = "Pods-OHHTTPStubsDemo"; + productReference = 8738CED8CB17739066C976AAEB639DDC /* Pods_OHHTTPStubsDemo.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ @@ -446,7 +464,7 @@ D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0730; + LastSwiftUpdateCheck = 0830; LastUpgradeCheck = 0700; }; buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; @@ -461,7 +479,7 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 748F1C7F61D88F3FB355A8E829489671 /* OHHTTPStubs */, + 43DF549FDD179C35F50D1ED98490A019 /* OHHTTPStubs */, 4DAB16E5D4A9B995759E4E4E7B2E8992 /* Pods-OHHTTPStubsDemo */, ); }; @@ -476,19 +494,21 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - BDA322F9A3B29B31661AE13DB299100B /* Sources */ = { + 3979F59FC609AD486B1DD497386F276C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - B43DF950C82CC959A01F4CC06C540290 /* NSURLRequest+HTTPBodyTesting.m in Sources */, - A6D958FC0D5892BED0B1FF27D8DB5694 /* OHHTTPStubs+NSURLSessionConfiguration.m in Sources */, - 2B5C4A6FB99B6CAC2D4BA85DAF91FDEA /* OHHTTPStubs-dummy.m in Sources */, - 27E98DC6DD56F470AD820D47F257A1A6 /* OHHTTPStubs.m in Sources */, - FE0EE9E83A093A95A959687BC65FC2C3 /* OHHTTPStubsMethodSwizzling.m in Sources */, - 908C174297315DFB382C4F3BCA828627 /* OHHTTPStubsResponse+JSON.m in Sources */, - 60BE7023AF5678BADF6825229A748CCA /* OHHTTPStubsResponse.m in Sources */, - 294553EE0D798B0B7220BF3AD4F200DF /* OHHTTPStubsSwift.swift in Sources */, - D8DFE97639FB74453BBC78D7DAAB63F7 /* OHPathHelpers.m in Sources */, + FAFB126969B43E3DB082A94F57F623C1 /* NSURLRequest+HTTPBodyTesting.m in Sources */, + 5674F99AA11DB55043362FF8B0A7A681 /* OHHTTPStubs+NSURLSessionConfiguration.m in Sources */, + 0DFF736AB00087E95576F72E7FB07AC8 /* OHHTTPStubs-dummy.m in Sources */, + BE9302235C52E7EB7948964B1EC236C0 /* OHHTTPStubs.m in Sources */, + 39E3E34CE2B0B3E33E4E222B7E6AAF7B /* OHHTTPStubsDescriptor.m in Sources */, + 5780F913507604A309EC5643F20CF00D /* OHHTTPStubsMethodSwizzling.m in Sources */, + 8B7BF652E6CD4DB85087D3FA15F83D41 /* OHHTTPStubsProtocol.m in Sources */, + 38CFD88E2DF9D560F02BF68DFDAAC1AA /* OHHTTPStubsResponse+JSON.m in Sources */, + CDEA6B147923587159C4E18EFFDD7F40 /* OHHTTPStubsResponse.m in Sources */, + 8DA9BA3240AB05AF1B21FC9B090E89F4 /* OHHTTPStubsSwift.swift in Sources */, + 5C7101982CAAC3DF63C0A9315F6EF72C /* OHPathHelpers.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -498,17 +518,52 @@ EA00E4A7BAECB75DA0018817B800D1B2 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = OHHTTPStubs; - target = 748F1C7F61D88F3FB355A8E829489671 /* OHHTTPStubs */; + target = 43DF549FDD179C35F50D1ED98490A019 /* OHHTTPStubs */; targetProxy = 51BC74209740FD4CCAB3E7BAC4A35E60 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - 015A368F878AC3E2CEAE21DDE8026304 /* Debug */ = { + 2A08BE4AA5DBEC1D28E2CA2207ED782E /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E56DE22A0F090D8C9CBFEA942214081F /* OHHTTPStubs.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/OHHTTPStubs/OHHTTPStubs-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/OHHTTPStubs/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/OHHTTPStubs/OHHTTPStubs.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = OHHTTPStubs; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 3.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 34FE9531DA9AF2820790339988D5FF41 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -516,24 +571,23 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGNING_REQUIRED = NO; - COPY_PHASE_STRIP = NO; - ENABLE_TESTABILITY = YES; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( - "POD_CONFIGURATION_DEBUG=1", - "DEBUG=1", + "POD_CONFIGURATION_RELEASE=1", "$(inherited)", ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -541,17 +595,18 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; - ONLY_ACTIVE_ARCH = YES; PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; STRIP_INSTALLED_PRODUCT = NO; SYMROOT = "${SRCROOT}/../build"; + VALIDATE_PRODUCT = YES; }; - name = Debug; + name = Release; }; - 35D10D38E885F7B6BA05F71300137A71 /* Release */ = { + 88130874B411829A39EF8181E5AFF383 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 8538626B48EE5872A21F58430C92C3DD /* Pods-OHHTTPStubsDemo.release.xcconfig */; buildSettings = { + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; @@ -577,17 +632,20 @@ PRODUCT_NAME = Pods_OHHTTPStubsDemo; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Release; }; - 44CDBB6D11DE06DB64D6268622BDC47E /* Release */ = { + C104F7F091290C3D1E248192F07FE689 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -595,20 +653,27 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGNING_REQUIRED = NO; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; + COPY_PHASE_STRIP = NO; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( - "POD_CONFIGURATION_RELEASE=1", + "POD_CONFIGURATION_DEBUG=1", + "DEBUG=1", "$(inherited)", ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -616,17 +681,18 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; + ONLY_ACTIVE_ARCH = YES; PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; STRIP_INSTALLED_PRODUCT = NO; SYMROOT = "${SRCROOT}/../build"; - VALIDATE_PRODUCT = YES; }; - name = Release; + name = Debug; }; - 5B25F99C125B1F6949D09ED721AB654A /* Debug */ = { + C96F7DEB8E9931977B18FCC9309C5318 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = E56DE22A0F090D8C9CBFEA942214081F /* OHHTTPStubs.xcconfig */; buildSettings = { + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; @@ -648,6 +714,7 @@ PRODUCT_NAME = OHHTTPStubs; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -656,10 +723,11 @@ }; name = Debug; }; - 8520B4E3B4D4FEEAF8157BF41BDA1108 /* Debug */ = { + F5BD39A619C33958EB2741000A7381A6 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = E82F2FA8F4A57A7D1D3F5FEDF1349021 /* Pods-OHHTTPStubsDemo.debug.xcconfig */; buildSettings = { + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; @@ -685,44 +753,14 @@ PRODUCT_NAME = Pods_OHHTTPStubsDemo; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - B6CD7738FEC61676CF6BBD0D14EF1211 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E56DE22A0F090D8C9CBFEA942214081F /* OHHTTPStubs.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/OHHTTPStubs/OHHTTPStubs-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/OHHTTPStubs/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/OHHTTPStubs/OHHTTPStubs.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = OHHTTPStubs; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Release; + name = Debug; }; /* End XCBuildConfiguration section */ @@ -730,8 +768,8 @@ 17F022695A72ABD0379F85E26C02EC4F /* Build configuration list for PBXNativeTarget "Pods-OHHTTPStubsDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( - 8520B4E3B4D4FEEAF8157BF41BDA1108 /* Debug */, - 35D10D38E885F7B6BA05F71300137A71 /* Release */, + F5BD39A619C33958EB2741000A7381A6 /* Debug */, + 88130874B411829A39EF8181E5AFF383 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -739,17 +777,17 @@ 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { isa = XCConfigurationList; buildConfigurations = ( - 015A368F878AC3E2CEAE21DDE8026304 /* Debug */, - 44CDBB6D11DE06DB64D6268622BDC47E /* Release */, + C104F7F091290C3D1E248192F07FE689 /* Debug */, + 34FE9531DA9AF2820790339988D5FF41 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - C85E9BCC67642A6B5D72777C9A2EFC1C /* Build configuration list for PBXNativeTarget "OHHTTPStubs" */ = { + D391FFF705E294791BF3C9F36FD82D64 /* Build configuration list for PBXNativeTarget "OHHTTPStubs" */ = { isa = XCConfigurationList; buildConfigurations = ( - 5B25F99C125B1F6949D09ED721AB654A /* Debug */, - B6CD7738FEC61676CF6BBD0D14EF1211 /* Release */, + C96F7DEB8E9931977B18FCC9309C5318 /* Debug */, + 2A08BE4AA5DBEC1D28E2CA2207ED782E /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/Examples/Swift/Pods/Target Support Files/OHHTTPStubs/OHHTTPStubs-umbrella.h b/Examples/Swift/Pods/Target Support Files/OHHTTPStubs/OHHTTPStubs-umbrella.h index 48c9d154..2710ea34 100644 --- a/Examples/Swift/Pods/Target Support Files/OHHTTPStubs/OHHTTPStubs-umbrella.h +++ b/Examples/Swift/Pods/Target Support Files/OHHTTPStubs/OHHTTPStubs-umbrella.h @@ -13,6 +13,7 @@ #import "Compatibility.h" #import "OHHTTPStubs.h" #import "OHHTTPStubsResponse.h" +#import "OHHTTPStubsTypes.h" #import "OHHTTPStubsResponse+JSON.h" #import "NSURLRequest+HTTPBodyTesting.h" #import "OHPathHelpers.h" diff --git a/OHHTTPStubs.podspec b/OHHTTPStubs.podspec index 7bb410c0..7dfa770b 100644 --- a/OHHTTPStubs.podspec +++ b/OHHTTPStubs.podspec @@ -47,6 +47,7 @@ Pod::Spec.new do |s| s.subspec 'Core' do |core| core.source_files = "OHHTTPStubs/Sources/*.{h,m}" core.public_header_files = "OHHTTPStubs/Sources/*.h" + core.private_header_files = "OHHTTPStubs/Sources/OHHTTPStubsDescriptor.h", "OHHTTPStubs/Sources/OHHTTPStubsProtocol.h" end # Optional subspecs diff --git a/OHHTTPStubs/OHHTTPStubs.xcodeproj/project.pbxproj b/OHHTTPStubs/OHHTTPStubs.xcodeproj/project.pbxproj index c0132fbe..72a52847 100644 --- a/OHHTTPStubs/OHHTTPStubs.xcodeproj/project.pbxproj +++ b/OHHTTPStubs/OHHTTPStubs.xcodeproj/project.pbxproj @@ -115,6 +115,26 @@ 46C7329D1CDAC2DC00CDBCB5 /* login_content_type.tail in Resources */ = {isa = PBXBuildFile; fileRef = 46C732911CDAC2DB00CDBCB5 /* login_content_type.tail */; }; 47AF337B1A3775B600158C9F /* emptyfile.json in Resources */ = {isa = PBXBuildFile; fileRef = 47AF337A1A37757B00158C9F /* emptyfile.json */; }; 47AF337C1A3775B600158C9F /* emptyfile.json in Resources */ = {isa = PBXBuildFile; fileRef = 47AF337A1A37757B00158C9F /* emptyfile.json */; }; + 4A65DF461EB499360099849C /* OHHTTPStubsProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A65DF451EB499360099849C /* OHHTTPStubsProtocol.m */; }; + 4A65DF471EB499420099849C /* OHHTTPStubsProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A65DF451EB499360099849C /* OHHTTPStubsProtocol.m */; }; + 4A65DF481EB499430099849C /* OHHTTPStubsProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A65DF451EB499360099849C /* OHHTTPStubsProtocol.m */; }; + 4A65DF491EB499440099849C /* OHHTTPStubsProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A65DF451EB499360099849C /* OHHTTPStubsProtocol.m */; }; + 4A65DF4A1EB499500099849C /* OHHTTPStubsProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A65DF441EB499360099849C /* OHHTTPStubsProtocol.h */; }; + 4A65DF4B1EB499540099849C /* OHHTTPStubsProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A65DF441EB499360099849C /* OHHTTPStubsProtocol.h */; }; + 4A65DF4C1EB499570099849C /* OHHTTPStubsProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A65DF441EB499360099849C /* OHHTTPStubsProtocol.h */; }; + 4A65DF4D1EB499780099849C /* OHHTTPStubsProtocol.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4A65DF441EB499360099849C /* OHHTTPStubsProtocol.h */; }; + 4A9926521EB49C220000A9B6 /* OHHTTPStubsDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A9926501EB49C220000A9B6 /* OHHTTPStubsDescriptor.h */; }; + 4A9926531EB49C220000A9B6 /* OHHTTPStubsDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A9926501EB49C220000A9B6 /* OHHTTPStubsDescriptor.h */; }; + 4A9926541EB49C220000A9B6 /* OHHTTPStubsDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A9926501EB49C220000A9B6 /* OHHTTPStubsDescriptor.h */; }; + 4A9926551EB49C220000A9B6 /* OHHTTPStubsDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A9926511EB49C220000A9B6 /* OHHTTPStubsDescriptor.m */; }; + 4A9926561EB49C220000A9B6 /* OHHTTPStubsDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A9926511EB49C220000A9B6 /* OHHTTPStubsDescriptor.m */; }; + 4A9926571EB49C220000A9B6 /* OHHTTPStubsDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A9926511EB49C220000A9B6 /* OHHTTPStubsDescriptor.m */; }; + 4A9926581EB49C220000A9B6 /* OHHTTPStubsDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A9926511EB49C220000A9B6 /* OHHTTPStubsDescriptor.m */; }; + 4A99265A1EB49CD60000A9B6 /* OHHTTPStubsTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A9926591EB49CD60000A9B6 /* OHHTTPStubsTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4A99265B1EB49CD60000A9B6 /* OHHTTPStubsTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A9926591EB49CD60000A9B6 /* OHHTTPStubsTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4A99265C1EB49CD60000A9B6 /* OHHTTPStubsTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A9926591EB49CD60000A9B6 /* OHHTTPStubsTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4A99265D1EB49E260000A9B6 /* OHHTTPStubsTypes.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4A9926591EB49CD60000A9B6 /* OHHTTPStubsTypes.h */; }; + 4A99265E1EB49E260000A9B6 /* OHHTTPStubsDescriptor.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4A9926501EB49C220000A9B6 /* OHHTTPStubsDescriptor.h */; }; 725CD9B41A9EB6F600F84C8B /* OHHTTPStubs.m in Sources */ = {isa = PBXBuildFile; fileRef = 09110A6B1980605A00D175E4 /* OHHTTPStubs.m */; }; 725CD9B51A9EB6F800F84C8B /* OHHTTPStubsResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 09110A6F1980606A00D175E4 /* OHHTTPStubsResponse.m */; }; 725CD9B61A9EB6FA00F84C8B /* OHHTTPStubsResponse+HTTPMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 09110A711980606A00D175E4 /* OHHTTPStubsResponse+HTTPMessage.m */; }; @@ -206,6 +226,9 @@ dstPath = "include/$(PRODUCT_NAME)"; dstSubfolderSpec = 16; files = ( + 4A99265D1EB49E260000A9B6 /* OHHTTPStubsTypes.h in CopyFiles */, + 4A99265E1EB49E260000A9B6 /* OHHTTPStubsDescriptor.h in CopyFiles */, + 4A65DF4D1EB499780099849C /* OHHTTPStubsProtocol.h in CopyFiles */, DC46585E1CAD260F00344232 /* NSURLRequest+HTTPBodyTesting.h in CopyFiles */, 09D0D29B1B67FF06004E7213 /* Compatibility.h in CopyFiles */, 095981FC19806AF300807DBE /* OHHTTPStubs.h in CopyFiles */, @@ -272,6 +295,11 @@ 46C732901CDAC2DB00CDBCB5 /* login_content_type_and_headers.tail */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = login_content_type_and_headers.tail; sourceTree = ""; }; 46C732911CDAC2DB00CDBCB5 /* login_content_type.tail */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = login_content_type.tail; sourceTree = ""; }; 47AF337A1A37757B00158C9F /* emptyfile.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = emptyfile.json; sourceTree = ""; }; + 4A65DF441EB499360099849C /* OHHTTPStubsProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubsProtocol.h; sourceTree = ""; }; + 4A65DF451EB499360099849C /* OHHTTPStubsProtocol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubsProtocol.m; sourceTree = ""; }; + 4A9926501EB49C220000A9B6 /* OHHTTPStubsDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubsDescriptor.h; sourceTree = ""; }; + 4A9926511EB49C220000A9B6 /* OHHTTPStubsDescriptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OHHTTPStubsDescriptor.m; sourceTree = ""; }; + 4A9926591EB49CD60000A9B6 /* OHHTTPStubsTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OHHTTPStubsTypes.h; sourceTree = ""; }; 4F8E695A8205C9F383F637AB /* libPods-TestingPods-OHHTTPStubs Mac Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-TestingPods-OHHTTPStubs Mac Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 655D2E61F142E992FA46C016 /* Pods-TestingPods-OHHTTPStubs tvOS Fmk Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TestingPods-OHHTTPStubs tvOS Fmk Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-TestingPods-OHHTTPStubs tvOS Fmk Tests/Pods-TestingPods-OHHTTPStubs tvOS Fmk Tests.release.xcconfig"; sourceTree = ""; }; 669D2FDD93B6C9E283419C17 /* libPods-TestingPods-OHHTTPStubs iOS Fmk Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-TestingPods-OHHTTPStubs iOS Fmk Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -470,6 +498,11 @@ children = ( 09110A6A1980605A00D175E4 /* OHHTTPStubs.h */, 09110A6B1980605A00D175E4 /* OHHTTPStubs.m */, + 4A9926591EB49CD60000A9B6 /* OHHTTPStubsTypes.h */, + 4A65DF441EB499360099849C /* OHHTTPStubsProtocol.h */, + 4A65DF451EB499360099849C /* OHHTTPStubsProtocol.m */, + 4A9926501EB49C220000A9B6 /* OHHTTPStubsDescriptor.h */, + 4A9926511EB49C220000A9B6 /* OHHTTPStubsDescriptor.m */, ); name = OHHTTPStubs; sourceTree = ""; @@ -595,11 +628,14 @@ 09D0D29A1B67FED3004E7213 /* Compatibility.h in Headers */, 095981FB19806AB700807DBE /* OHHTTPStubs.h in Headers */, 0959820019806B1700807DBE /* OHHTTPStubsResponse.h in Headers */, + 4A65DF4B1EB499540099849C /* OHHTTPStubsProtocol.h in Headers */, + 4A9926531EB49C220000A9B6 /* OHHTTPStubsDescriptor.h in Headers */, 0959820219806B2200807DBE /* OHHTTPStubsResponse+JSON.h in Headers */, 0959820119806B1E00807DBE /* OHHTTPStubsResponse+HTTPMessage.h in Headers */, 094906DF1B7F60EE00B047DA /* OHHTTPStubs+Mocktail.h in Headers */, 095B1AD71AE3138C009D1B56 /* OHPathHelpers.h in Headers */, DC46585C1CAD245D00344232 /* NSURLRequest+HTTPBodyTesting.h in Headers */, + 4A99265B1EB49CD60000A9B6 /* OHHTTPStubsTypes.h in Headers */, 1B5632F11CB2A9C200388C9B /* OHHTTPStubsMethodSwizzling.h in Headers */, 09199FD01BD974F20014376D /* OHHTTPStubsUmbrella.h in Headers */, ); @@ -612,11 +648,14 @@ 09D0D2991B67FED3004E7213 /* Compatibility.h in Headers */, 725CD9B91A9EB71000F84C8B /* OHHTTPStubs.h in Headers */, 725CD9BA1A9EB71500F84C8B /* OHHTTPStubsResponse.h in Headers */, + 4A65DF4A1EB499500099849C /* OHHTTPStubsProtocol.h in Headers */, + 4A9926521EB49C220000A9B6 /* OHHTTPStubsDescriptor.h in Headers */, 725CD9BB1A9EB71A00F84C8B /* OHHTTPStubsResponse+JSON.h in Headers */, 725CD9BC1A9EB71D00F84C8B /* OHHTTPStubsResponse+HTTPMessage.h in Headers */, 094906DE1B7F60E200B047DA /* OHHTTPStubs+Mocktail.h in Headers */, 095B1AD61AE3138C009D1B56 /* OHPathHelpers.h in Headers */, DC46585B1CAD245C00344232 /* NSURLRequest+HTTPBodyTesting.h in Headers */, + 4A99265A1EB49CD60000A9B6 /* OHHTTPStubsTypes.h in Headers */, 1B5632F01CB2A9C200388C9B /* OHHTTPStubsMethodSwizzling.h in Headers */, 09199FCF1BD974F10014376D /* OHHTTPStubsUmbrella.h in Headers */, ); @@ -629,11 +668,14 @@ EAA436991BE1598D000E9E99 /* Compatibility.h in Headers */, EAA4369A1BE1598D000E9E99 /* OHHTTPStubs.h in Headers */, EAA4369B1BE1598D000E9E99 /* OHHTTPStubsResponse.h in Headers */, + 4A65DF4C1EB499570099849C /* OHHTTPStubsProtocol.h in Headers */, + 4A9926541EB49C220000A9B6 /* OHHTTPStubsDescriptor.h in Headers */, EAA4369C1BE1598D000E9E99 /* OHHTTPStubsResponse+JSON.h in Headers */, EAA4369D1BE1598D000E9E99 /* OHHTTPStubsResponse+HTTPMessage.h in Headers */, EAA4369E1BE1598D000E9E99 /* OHHTTPStubs+Mocktail.h in Headers */, EAA4369F1BE1598D000E9E99 /* OHPathHelpers.h in Headers */, DC46585D1CAD245E00344232 /* NSURLRequest+HTTPBodyTesting.h in Headers */, + 4A99265C1EB49CD60000A9B6 /* OHHTTPStubsTypes.h in Headers */, 1B5632F21CB2A9C200388C9B /* OHHTTPStubsMethodSwizzling.h in Headers */, EAA436A01BE1598D000E9E99 /* OHHTTPStubsUmbrella.h in Headers */, ); @@ -1122,6 +1164,8 @@ files = ( DC4658561CAD192600344232 /* NSURLRequest+HTTPBodyTesting.m in Sources */, 1B5632F31CB2A9C200388C9B /* OHHTTPStubsMethodSwizzling.m in Sources */, + 4A9926551EB49C220000A9B6 /* OHHTTPStubsDescriptor.m in Sources */, + 4A65DF461EB499360099849C /* OHHTTPStubsProtocol.m in Sources */, 09110A6C1980605A00D175E4 /* OHHTTPStubs.m in Sources */, 09110A791980608600D175E4 /* OHHTTPStubs+NSURLSessionConfiguration.m in Sources */, 1D6DB8501B763B7A00FCF855 /* OHHTTPStubs+Mocktail.m in Sources */, @@ -1170,12 +1214,14 @@ buildActionMask = 2147483647; files = ( 095981F619806AAC00807DBE /* OHHTTPStubs.m in Sources */, + 4A9926571EB49C220000A9B6 /* OHHTTPStubsDescriptor.m in Sources */, 095981FA19806AAC00807DBE /* OHHTTPStubs+NSURLSessionConfiguration.m in Sources */, 094906D81B7F520200B047DA /* OHHTTPStubs+Mocktail.m in Sources */, 1B5632F51CB2A9C200388C9B /* OHHTTPStubsMethodSwizzling.m in Sources */, 095981F719806AAC00807DBE /* OHHTTPStubsResponse.m in Sources */, 095981F919806AAC00807DBE /* OHHTTPStubsResponse+JSON.m in Sources */, 095981F819806AAC00807DBE /* OHHTTPStubsResponse+HTTPMessage.m in Sources */, + 4A65DF481EB499430099849C /* OHHTTPStubsProtocol.m in Sources */, 0501A1A81C63E0C600B120AE /* OHHTTPStubsSwift.swift in Sources */, 095B1AD91AE31396009D1B56 /* OHPathHelpers.m in Sources */, DC4658581CAD19A200344232 /* NSURLRequest+HTTPBodyTesting.m in Sources */, @@ -1204,12 +1250,14 @@ buildActionMask = 2147483647; files = ( 725CD9B41A9EB6F600F84C8B /* OHHTTPStubs.m in Sources */, + 4A9926561EB49C220000A9B6 /* OHHTTPStubsDescriptor.m in Sources */, 725CD9B81A9EB70000F84C8B /* OHHTTPStubs+NSURLSessionConfiguration.m in Sources */, 094906D71B7F520200B047DA /* OHHTTPStubs+Mocktail.m in Sources */, 1B5632F41CB2A9C200388C9B /* OHHTTPStubsMethodSwizzling.m in Sources */, 725CD9B51A9EB6F800F84C8B /* OHHTTPStubsResponse.m in Sources */, 725CD9B71A9EB6FD00F84C8B /* OHHTTPStubsResponse+JSON.m in Sources */, 725CD9B61A9EB6FA00F84C8B /* OHHTTPStubsResponse+HTTPMessage.m in Sources */, + 4A65DF471EB499420099849C /* OHHTTPStubsProtocol.m in Sources */, 09199FD11BD98D1C0014376D /* OHHTTPStubsSwift.swift in Sources */, 095B1AD81AE31395009D1B56 /* OHPathHelpers.m in Sources */, DC4658571CAD19A200344232 /* NSURLRequest+HTTPBodyTesting.m in Sources */, @@ -1238,12 +1286,14 @@ buildActionMask = 2147483647; files = ( EAA4368F1BE1598D000E9E99 /* OHHTTPStubs.m in Sources */, + 4A9926581EB49C220000A9B6 /* OHHTTPStubsDescriptor.m in Sources */, EAA436901BE1598D000E9E99 /* OHHTTPStubs+NSURLSessionConfiguration.m in Sources */, EAA436911BE1598D000E9E99 /* OHHTTPStubs+Mocktail.m in Sources */, 1B5632F61CB2A9C200388C9B /* OHHTTPStubsMethodSwizzling.m in Sources */, EAA436921BE1598D000E9E99 /* OHHTTPStubsResponse.m in Sources */, EAA436931BE1598D000E9E99 /* OHHTTPStubsResponse+JSON.m in Sources */, EAA436941BE1598D000E9E99 /* OHHTTPStubsResponse+HTTPMessage.m in Sources */, + 4A65DF491EB499440099849C /* OHHTTPStubsProtocol.m in Sources */, EAA436951BE1598D000E9E99 /* OHHTTPStubsSwift.swift in Sources */, EAA436961BE1598D000E9E99 /* OHPathHelpers.m in Sources */, DC46585A1CAD19A300344232 /* NSURLRequest+HTTPBodyTesting.m in Sources */, diff --git a/OHHTTPStubs/Sources/OHHTTPStubs.h b/OHHTTPStubs/Sources/OHHTTPStubs.h index 3ac80afb..5005e88b 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubs.h +++ b/OHHTTPStubs/Sources/OHHTTPStubs.h @@ -29,40 +29,10 @@ #import #import "Compatibility.h" -#import "OHHTTPStubsResponse.h" +#import "OHHTTPStubsTypes.h" NS_ASSUME_NONNULL_BEGIN -//////////////////////////////////////////////////////////////////////////////// -#pragma mark - Types - -typedef BOOL(^OHHTTPStubsTestBlock)(NSURLRequest* request); -typedef OHHTTPStubsResponse* __nonnull (^OHHTTPStubsResponseBlock)( NSURLRequest* request); - -/** - * This opaque type represents an installed stub and is used to uniquely - * identify a stub once it has been created. - * - * This type is returned by the `stubRequestsPassingTest:withStubResponse:` method - * so that you can later reference it and use this reference to remove the stub later. - * - * This type also let you add arbitrary metadata to a stub to differenciate it - * more easily when debugging. - */ -@protocol OHHTTPStubsDescriptor -/** - * An arbitrary name that you can set and get to describe your stub. - * Use it as your own convenience. - * - * This is especially useful if you dump all installed stubs using `allStubs` - * or if you want to log which stubs are being triggered using `onStubActivation:`. - */ -@property(nonatomic, strong, nullable) NSString* name; -@end - -//////////////////////////////////////////////////////////////////////////////// -#pragma mark - Interface - /** * Stubs Manager. Use this class to add and remove stubs and stub your network requests. */ diff --git a/OHHTTPStubs/Sources/OHHTTPStubs.m b/OHHTTPStubs/Sources/OHHTTPStubs.m index 85a5d5cc..d882dd88 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubs.m +++ b/OHHTTPStubs/Sources/OHHTTPStubs.m @@ -30,74 +30,22 @@ #pragma mark - Imports #import "OHHTTPStubs.h" -#import - -//////////////////////////////////////////////////////////////////////////////// -#pragma mark - Types & Constants - -@interface OHHTTPStubsProtocolClassProxy : NSProxy - -- (instancetype)initWithStubs:(OHHTTPStubs*)stubs; - -@end - -@interface OHHTTPStubsProtocolInstanceProxy : NSProxy - -- (instancetype)initWithStubs:(OHHTTPStubs *)stubs; - -@property(atomic, weak, readonly) OHHTTPStubs* stubs; - -@end - -@interface OHHTTPStubsProtocol : NSURLProtocol - -- (id)initWithStubs:(OHHTTPStubs *)stubs - request:(NSURLRequest *)request - cachedResponse:(NSCachedURLResponse *)response - client:(id)client; - -@end - -static NSTimeInterval const kSlotTime = 0.25; // Must be >0. We will send a chunk of the data from the stream each 'slotTime' seconds +#import "OHHTTPStubsDescriptor.h" +#import "OHHTTPStubsProtocol.h" //////////////////////////////////////////////////////////////////////////////// #pragma mark - Private Interfaces -@interface OHHTTPStubs() +@interface OHHTTPStubs() + + (instancetype)sharedInstance; + @property(atomic, strong) id protocolClass; @property(atomic, copy) NSMutableArray* stubDescriptors; @property(atomic, assign) BOOL enabledState; @property(atomic, copy, nullable) void (^onStubActivationBlock)(NSURLRequest*, id, OHHTTPStubsResponse*); @property(atomic, copy, nullable) void (^onStubRedirectBlock)(NSURLRequest*, NSURLRequest*, id, OHHTTPStubsResponse*); @property(atomic, copy, nullable) void (^afterStubFinishBlock)(NSURLRequest*, id, OHHTTPStubsResponse*, NSError*); -@end - -@interface OHHTTPStubsDescriptor : NSObject -@property(atomic, copy) OHHTTPStubsTestBlock testBlock; -@property(atomic, copy) OHHTTPStubsResponseBlock responseBlock; -@end - -//////////////////////////////////////////////////////////////////////////////// -#pragma mark - OHHTTPStubsDescriptor Implementation - -@implementation OHHTTPStubsDescriptor - -@synthesize name = _name; - -+(instancetype)stubDescriptorWithTestBlock:(OHHTTPStubsTestBlock)testBlock - responseBlock:(OHHTTPStubsResponseBlock)responseBlock -{ - OHHTTPStubsDescriptor* stub = [OHHTTPStubsDescriptor new]; - stub.testBlock = testBlock; - stub.responseBlock = responseBlock; - return stub; -} - --(NSString*)description -{ - return [NSString stringWithFormat:@"<%@ %p : %@>", self.class, self, self.name]; -} @end @@ -129,7 +77,7 @@ - (instancetype)initEnabled:(BOOL)enabled if (self) { _stubDescriptors = [NSMutableArray array]; - _protocolClass = [[OHHTTPStubsProtocolClassProxy alloc] initWithStubs:self]; + _protocolClass = [[OHHTTPStubsProtocolClassProxy alloc] initWithManager:self]; _enabledState = enabled; if (enabled) { [self _setEnable:YES]; @@ -343,418 +291,3 @@ - (OHHTTPStubsDescriptor*)firstStubPassingTestForRequest:(NSURLRequest*)request } @end - - - - - - - - - - -//////////////////////////////////////////////////////////////////////////////// -#pragma mark - Private Protocol Class - -@interface NSURLProtocol() - -+ (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request task:(NSURLSessionTask*)task; - -@end - -@implementation OHHTTPStubsProtocolClassProxy -{ - OHHTTPStubsProtocolInstanceProxy *_instance; -} - -- (instancetype)initWithStubs:(OHHTTPStubs *)stubs { - _instance = [[OHHTTPStubsProtocolInstanceProxy alloc] initWithStubs:stubs]; - return self; -} - -- (Class)superclass { - return [OHHTTPStubsProtocol superclass]; -} - -- (Class)class { - return (id)self; -} - -- (BOOL)isSubclassOfClass:(Class)klass { - return [OHHTTPStubsProtocol isSubclassOfClass:klass]; -} - -- (BOOL)canInitWithRequest:(NSURLRequest *)request -{ - return ([_instance.stubs firstStubPassingTestForRequest:request] != nil); -} - -- (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request -{ - return request; -} - -- (id)alloc NS_RETURNS_RETAINED { - return _instance; -} - -- (BOOL)respondsToSelector:(SEL)aSelector { - return [OHHTTPStubsProtocol respondsToSelector:aSelector]; -} - -- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel { - return [OHHTTPStubsProtocol methodSignatureForSelector:sel]; -} - -+ (BOOL)resolveInstanceMethod:(SEL)sel { - Method m = class_getClassMethod(OHHTTPStubsProtocol.self, sel); - if (!m) { - return NO; - } - class_addMethod(self, sel, method_getImplementation(m), method_getTypeEncoding(m)); - return YES; -} - -@end - -@implementation OHHTTPStubsProtocolInstanceProxy - -- (instancetype)initWithStubs:(OHHTTPStubs *)stubs { - _stubs = stubs; - return self; -} - -- (id)initWithRequest:(NSURLRequest *)request cachedResponse:(NSCachedURLResponse *)response client:(id)client { - return (id)[[OHHTTPStubsProtocol alloc] initWithStubs:_stubs request:request cachedResponse:response client:client]; -} - -- (Class)class { - NSAssert(NO, @"-[OHHTTPStubsProtocolInstanceProxy class] is not implemented"); - return [OHHTTPStubsProtocol class]; -} - -- (Class)superclass { - return [OHHTTPStubsProtocol superclass]; -} - -- (BOOL)respondsToSelector:(SEL)aSelector { - return [OHHTTPStubsProtocol instancesRespondToSelector:aSelector]; -} - -- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel { - return [OHHTTPStubsProtocol instanceMethodSignatureForSelector:sel]; -} - -+ (BOOL)resolveInstanceMethod:(SEL)sel { - Method m = class_getInstanceMethod(OHHTTPStubsProtocol.self, sel); - if (!m) { - return NO; - } - - class_addMethod(self, sel, method_getImplementation(m), method_getTypeEncoding(m)); - return YES; -} - -@end - - -@interface OHHTTPStubsProtocol() -@property(assign) BOOL stopped; -@property(strong) OHHTTPStubs* stubs; -@property(strong) OHHTTPStubsDescriptor* stub; -@property(assign) CFRunLoopRef clientRunLoop; -- (void)executeOnClientRunLoopAfterDelay:(NSTimeInterval)delayInSeconds block:(dispatch_block_t)block; -@end - -@implementation OHHTTPStubsProtocol -{ - OHHTTPStubs *_stubs; -} - -+ (BOOL)canInitWithTask:(NSURLSessionTask *)task { - return [super canInitWithTask:task]; -} - -- (id)initWithStubs:(OHHTTPStubs *)stubs - request:(NSURLRequest *)request - cachedResponse:(NSCachedURLResponse *)response - client:(id)client -{ - NSParameterAssert(stubs); - - // Make super sure that we never use a cached response. - self = [super initWithRequest:request cachedResponse:nil client:client]; - if (self) { - self.stubs = stubs; - self.stub = [stubs firstStubPassingTestForRequest:self.request]; - } - return self; -} - -- (id)initWithStubs:(OHHTTPStubs *)stubs - task:(NSURLSessionTask *)task - cachedResponse:(NSCachedURLResponse *)cachedResponse - client:(id)client -{ - // Make super sure that we never use a cached response. - self = [super initWithTask:task cachedResponse:nil client:client]; - if (self) { - self.stubs = stubs; - self.stub = [stubs firstStubPassingTestForRequest:self.request]; - } - return self; -} - -- (NSCachedURLResponse *)cachedResponse -{ - return nil; -} - -- (void)startLoading -{ - self.clientRunLoop = CFRunLoopGetCurrent(); - NSURLRequest* request = self.request; - id client = self.client; - - if (!self.stub) - { - NSDictionary* userInfo = [NSDictionary dictionaryWithObjectsAndKeys: - @"It seems like the stub has been removed BEFORE the response had time to be sent.", - NSLocalizedFailureReasonErrorKey, - @"For more info, see https://github.com/AliSoftware/OHHTTPStubs/wiki/OHHTTPStubs-and-asynchronous-tests", - NSLocalizedRecoverySuggestionErrorKey, - request.URL, // Stop right here if request.URL is nil - NSURLErrorFailingURLErrorKey, - nil]; - NSError* error = [NSError errorWithDomain:@"OHHTTPStubs" code:500 userInfo:userInfo]; - [client URLProtocol:self didFailWithError:error]; - if (self.stubs.afterStubFinishBlock) - { - self.stubs.afterStubFinishBlock(request, self.stub, nil, error); - } - return; - } - - OHHTTPStubsResponse* responseStub = self.stub.responseBlock(request); - - if (self.stubs.onStubActivationBlock) - { - self.stubs.onStubActivationBlock(request, self.stub, responseStub); - } - - if (responseStub.error == nil) - { - NSHTTPURLResponse* urlResponse = [[NSHTTPURLResponse alloc] initWithURL:request.URL - statusCode:responseStub.statusCode - HTTPVersion:@"HTTP/1.1" - headerFields:responseStub.httpHeaders]; - - // Cookies handling - if (request.HTTPShouldHandleCookies && request.URL) - { - NSArray* cookies = [NSHTTPCookie cookiesWithResponseHeaderFields:responseStub.httpHeaders forURL:request.URL]; - if (cookies) - { - [NSHTTPCookieStorage.sharedHTTPCookieStorage setCookies:cookies forURL:request.URL mainDocumentURL:request.mainDocumentURL]; - } - } - - - NSString* redirectLocation = (responseStub.httpHeaders)[@"Location"]; - NSURL* redirectLocationURL; - if (redirectLocation) - { - redirectLocationURL = [NSURL URLWithString:redirectLocation]; - } - else - { - redirectLocationURL = nil; - } - [self executeOnClientRunLoopAfterDelay:responseStub.requestTime block:^{ - if (!self.stopped) - { - // Notify if a redirection occurred - if (((responseStub.statusCode > 300) && (responseStub.statusCode < 400)) && redirectLocationURL) - { - NSURLRequest* redirectRequest = [NSURLRequest requestWithURL:redirectLocationURL]; - [client URLProtocol:self wasRedirectedToRequest:redirectRequest redirectResponse:urlResponse]; - if (self.stubs.onStubRedirectBlock) - { - self.stubs.onStubRedirectBlock(request, redirectRequest, self.stub, responseStub); - } - } - - // Send the response (even for redirections) - [client URLProtocol:self didReceiveResponse:urlResponse cacheStoragePolicy:NSURLCacheStorageNotAllowed]; - if(responseStub.inputStream.streamStatus == NSStreamStatusNotOpen) - { - [responseStub.inputStream open]; - } - [self streamDataForClient:client - withStubResponse:responseStub - completion:^(NSError * error) - { - [responseStub.inputStream close]; - NSError *blockError = nil; - if (error==nil) - { - [client URLProtocolDidFinishLoading:self]; - } - else - { - [client URLProtocol:self didFailWithError:responseStub.error]; - blockError = responseStub.error; - } - if (self.stubs.afterStubFinishBlock) - { - self.stubs.afterStubFinishBlock(request, self.stub, responseStub, blockError); - } - }]; - } - }]; - } else { - // Send the canned error - [self executeOnClientRunLoopAfterDelay:responseStub.responseTime block:^{ - if (!self.stopped) - { - [client URLProtocol:self didFailWithError:responseStub.error]; - if (self.stubs.afterStubFinishBlock) - { - self.stubs.afterStubFinishBlock(request, self.stub, responseStub, responseStub.error); - } - } - }]; - } -} - -- (void)stopLoading -{ - self.stopped = YES; -} - -typedef struct { - NSTimeInterval slotTime; - double chunkSizePerSlot; - double cumulativeChunkSize; -} OHHTTPStubsStreamTimingInfo; - -- (void)streamDataForClient:(id)client - withStubResponse:(OHHTTPStubsResponse*)stubResponse - completion:(void(^)(NSError * error))completion -{ - if (!self.stopped) - { - if ((stubResponse.dataSize>0) && stubResponse.inputStream.hasBytesAvailable) - { - // Compute timing data once and for all for this stub - - OHHTTPStubsStreamTimingInfo timingInfo = { - .slotTime = kSlotTime, // Must be >0. We will send a chunk of data from the stream each 'slotTime' seconds - .cumulativeChunkSize = 0 - }; - - if(stubResponse.responseTime < 0) - { - // Bytes send each 'slotTime' seconds = Speed in KB/s * 1000 * slotTime in seconds - timingInfo.chunkSizePerSlot = (fabs(stubResponse.responseTime) * 1000) * timingInfo.slotTime; - } - else if (stubResponse.responseTime < kSlotTime) // includes case when responseTime == 0 - { - // We want to send the whole data quicker than the slotTime, so send it all in one chunk. - timingInfo.chunkSizePerSlot = stubResponse.dataSize; - timingInfo.slotTime = stubResponse.responseTime; - } - else - { - // Bytes send each 'slotTime' seconds = (Whole size in bytes / response time) * slotTime = speed in bps * slotTime in seconds - timingInfo.chunkSizePerSlot = ((stubResponse.dataSize/stubResponse.responseTime) * timingInfo.slotTime); - } - - [self streamDataForClient:client - fromStream:stubResponse.inputStream - timingInfo:timingInfo - completion:completion]; - } - else - { - [self executeOnClientRunLoopAfterDelay:stubResponse.responseTime block:^{ - if (completion && !self.stopped) - { - completion(nil); - } - }]; - } - } -} - -- (void) streamDataForClient:(id)client - fromStream:(NSInputStream*)inputStream - timingInfo:(OHHTTPStubsStreamTimingInfo)timingInfo - completion:(void(^)(NSError * error))completion -{ - NSParameterAssert(timingInfo.chunkSizePerSlot > 0); - - if (inputStream.hasBytesAvailable && (!self.stopped)) - { - // This is needed in case we computed a non-integer chunkSizePerSlot, to avoid cumulative errors - double cumulativeChunkSizeAfterRead = timingInfo.cumulativeChunkSize + timingInfo.chunkSizePerSlot; - NSUInteger chunkSizeToRead = floor(cumulativeChunkSizeAfterRead) - floor(timingInfo.cumulativeChunkSize); - timingInfo.cumulativeChunkSize = cumulativeChunkSizeAfterRead; - - if (chunkSizeToRead == 0) - { - // Nothing to read at this pass, but probably later - [self executeOnClientRunLoopAfterDelay:timingInfo.slotTime block:^{ - [self streamDataForClient:client fromStream:inputStream - timingInfo:timingInfo completion:completion]; - }]; - } else { - uint8_t* buffer = (uint8_t*)malloc(sizeof(uint8_t)*chunkSizeToRead); - NSInteger bytesRead = [inputStream read:buffer maxLength:chunkSizeToRead]; - if (bytesRead > 0) - { - NSData * data = [NSData dataWithBytes:buffer length:bytesRead]; - // Wait for 'slotTime' seconds before sending the chunk. - // If bytesRead < chunkSizePerSlot (because we are near the EOF), adjust slotTime proportionally to the bytes remaining - [self executeOnClientRunLoopAfterDelay:((double)bytesRead / (double)chunkSizeToRead) * timingInfo.slotTime block:^{ - [client URLProtocol:self didLoadData:data]; - [self streamDataForClient:client fromStream:inputStream - timingInfo:timingInfo completion:completion]; - }]; - } - else - { - if (completion) - { - // Note: We may also arrive here with no error if we were just at the end of the stream (EOF) - // In that case, hasBytesAvailable did return YES (because at the limit of OEF) but nothing were read (because EOF) - // But then in that case inputStream.streamError will be nil so that's cool, we won't return an error anyway - completion(inputStream.streamError); - } - } - free(buffer); - } - } - else - { - if (completion) - { - completion(nil); - } - } -} - -///////////////////////////////////////////// -// Delayed execution utility methods -///////////////////////////////////////////// - -- (void)executeOnClientRunLoopAfterDelay:(NSTimeInterval)delayInSeconds block:(dispatch_block_t)block -{ - dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); - dispatch_after(popTime, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - CFRunLoopPerformBlock(self.clientRunLoop, kCFRunLoopDefaultMode, block); - CFRunLoopWakeUp(self.clientRunLoop); - }); -} - -@end diff --git a/OHHTTPStubs/Sources/OHHTTPStubsDescriptor.h b/OHHTTPStubs/Sources/OHHTTPStubsDescriptor.h new file mode 100644 index 00000000..92391ba7 --- /dev/null +++ b/OHHTTPStubs/Sources/OHHTTPStubsDescriptor.h @@ -0,0 +1,20 @@ +// +// OHHTTPStubsDescriptor.h +// OHHTTPStubs +// +// Created by Nickolas Pohilets on 29.04.17. +// Copyright © 2017 AliSoftware. All rights reserved. +// + +#import +#import "OHHTTPStubsTypes.h" + +@interface OHHTTPStubsDescriptor : NSObject + ++ (instancetype)stubDescriptorWithTestBlock:(OHHTTPStubsTestBlock)testBlock + responseBlock:(OHHTTPStubsResponseBlock)responseBlock; + +@property(atomic, copy) OHHTTPStubsTestBlock testBlock; +@property(atomic, copy) OHHTTPStubsResponseBlock responseBlock; + +@end diff --git a/OHHTTPStubs/Sources/OHHTTPStubsDescriptor.m b/OHHTTPStubs/Sources/OHHTTPStubsDescriptor.m new file mode 100644 index 00000000..6f39502c --- /dev/null +++ b/OHHTTPStubs/Sources/OHHTTPStubsDescriptor.m @@ -0,0 +1,29 @@ +// +// OHHTTPStubsDescriptor.m +// OHHTTPStubs +// +// Created by Nickolas Pohilets on 29.04.17. +// Copyright © 2017 AliSoftware. All rights reserved. +// + +#import "OHHTTPStubsDescriptor.h" + +@implementation OHHTTPStubsDescriptor + +@synthesize name = _name; + ++(instancetype)stubDescriptorWithTestBlock:(OHHTTPStubsTestBlock)testBlock + responseBlock:(OHHTTPStubsResponseBlock)responseBlock +{ + OHHTTPStubsDescriptor* stub = [OHHTTPStubsDescriptor new]; + stub.testBlock = testBlock; + stub.responseBlock = responseBlock; + return stub; +} + +-(NSString*)description +{ + return [NSString stringWithFormat:@"<%@ %p : %@>", self.class, self, self.name]; +} + +@end diff --git a/OHHTTPStubs/Sources/OHHTTPStubsProtocol.h b/OHHTTPStubs/Sources/OHHTTPStubsProtocol.h new file mode 100644 index 00000000..b1b4fc0c --- /dev/null +++ b/OHHTTPStubs/Sources/OHHTTPStubsProtocol.h @@ -0,0 +1,47 @@ +// +// OHHTTPStubsProtocol.h +// OHHTTPStubs +// +// Created by Nickolas Pohilets on 29.04.17. +// Copyright © 2017 AliSoftware. All rights reserved. +// + +#import +#import "OHHTTPStubsDescriptor.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol OHHTTPStubsManager + +- (OHHTTPStubsDescriptor* _Nullable)firstStubPassingTestForRequest:(NSURLRequest*)request; + +@property(atomic, readonly, copy, nullable) void (^onStubActivationBlock)(NSURLRequest*, id, OHHTTPStubsResponse*); +@property(atomic, readonly, copy, nullable) void (^onStubRedirectBlock)(NSURLRequest*, NSURLRequest*, id, OHHTTPStubsResponse*); +@property(atomic, readonly, copy, nullable) void (^afterStubFinishBlock)(NSURLRequest*, id, OHHTTPStubsResponse* _Nullable, NSError*); + +@end + +@interface OHHTTPStubsProtocolClassProxy : NSProxy + +- (instancetype)initWithManager:(id)manager; + +@end + +@interface OHHTTPStubsProtocolInstanceProxy : NSProxy + +- (instancetype)initWithManager:(id)manager; + +@property(atomic, weak, readonly) id manager; + +@end + +@interface OHHTTPStubsProtocol : NSURLProtocol + +- (id)initWithManager:(id)manager + request:(NSURLRequest *)request + cachedResponse:(NSCachedURLResponse *)response + client:(id)client; + +@end + +NS_ASSUME_NONNULL_END diff --git a/OHHTTPStubs/Sources/OHHTTPStubsProtocol.m b/OHHTTPStubs/Sources/OHHTTPStubsProtocol.m new file mode 100644 index 00000000..62062078 --- /dev/null +++ b/OHHTTPStubs/Sources/OHHTTPStubsProtocol.m @@ -0,0 +1,400 @@ +// +// OHHTTPStubsProtocol.m +// OHHTTPStubs +// +// Created by Nickolas Pohilets on 29.04.17. +// Copyright © 2017 AliSoftware. All rights reserved. +// + +#import "OHHTTPStubsProtocol.h" +#import + +//////////////////////////////////////////////////////////////////////////////// +#pragma mark - Types & Constants + +static NSTimeInterval const kSlotTime = 0.25; // Must be >0. We will send a chunk of the data from the stream each 'slotTime' seconds + +//////////////////////////////////////////////////////////////////////////////// +#pragma mark - Proxies + +@implementation OHHTTPStubsProtocolClassProxy +{ + OHHTTPStubsProtocolInstanceProxy *_instance; +} + +- (instancetype)initWithManager:(id)manager { + _instance = [[OHHTTPStubsProtocolInstanceProxy alloc] initWithManager:manager]; + return self; +} + +- (Class)superclass { + return [OHHTTPStubsProtocol superclass]; +} + +- (Class)class { + return (id)self; +} + +- (BOOL)isSubclassOfClass:(Class)klass { + return [OHHTTPStubsProtocol isSubclassOfClass:klass]; +} + +- (BOOL)canInitWithRequest:(NSURLRequest *)request +{ + return ([_instance.manager firstStubPassingTestForRequest:request] != nil); +} + +- (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request +{ + return request; +} + +- (id)alloc NS_RETURNS_RETAINED { + return _instance; +} + +- (BOOL)respondsToSelector:(SEL)aSelector { + return [OHHTTPStubsProtocol respondsToSelector:aSelector]; +} + +- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel { + return [OHHTTPStubsProtocol methodSignatureForSelector:sel]; +} + ++ (BOOL)resolveInstanceMethod:(SEL)sel { + Method m = class_getClassMethod(OHHTTPStubsProtocol.self, sel); + if (!m) { + return NO; + } + class_addMethod(self, sel, method_getImplementation(m), method_getTypeEncoding(m)); + return YES; +} + +@end + +@implementation OHHTTPStubsProtocolInstanceProxy + +- (instancetype)initWithManager:(id)manager { + _manager = manager; + return self; +} + +- (id)initWithRequest:(NSURLRequest *)request cachedResponse:(NSCachedURLResponse *)response client:(id)client { + return (id)[[OHHTTPStubsProtocol alloc] initWithManager:_manager request:request cachedResponse:response client:client]; +} + +- (Class)class { + NSAssert(NO, @"-[OHHTTPStubsProtocolInstanceProxy class] is not implemented"); + return [OHHTTPStubsProtocol class]; +} + +- (Class)superclass { + return [OHHTTPStubsProtocol superclass]; +} + +- (BOOL)respondsToSelector:(SEL)aSelector { + return [OHHTTPStubsProtocol instancesRespondToSelector:aSelector]; +} + +- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel { + return [OHHTTPStubsProtocol instanceMethodSignatureForSelector:sel]; +} + ++ (BOOL)resolveInstanceMethod:(SEL)sel { + Method m = class_getInstanceMethod(OHHTTPStubsProtocol.self, sel); + if (!m) { + return NO; + } + + class_addMethod(self, sel, method_getImplementation(m), method_getTypeEncoding(m)); + return YES; +} + +@end + +//////////////////////////////////////////////////////////////////////////////// +#pragma mark - Protocol + +@interface OHHTTPStubsProtocol() +@property(assign) BOOL stopped; +@property(strong) id manager; +@property(strong) OHHTTPStubsDescriptor* stub; +@property(assign) CFRunLoopRef clientRunLoop; +- (void)executeOnClientRunLoopAfterDelay:(NSTimeInterval)delayInSeconds block:(dispatch_block_t)block; +@end + +@implementation OHHTTPStubsProtocol + ++ (BOOL)canInitWithTask:(NSURLSessionTask *)task { + return [super canInitWithTask:task]; +} + +- (id)initWithManager:(id)manager + request:(NSURLRequest *)request + cachedResponse:(NSCachedURLResponse *)response + client:(id)client +{ + NSParameterAssert(manager); + + // Make super sure that we never use a cached response. + self = [super initWithRequest:request cachedResponse:nil client:client]; + if (self) { + self.manager = manager; + self.stub = [manager firstStubPassingTestForRequest:self.request]; + } + return self; +} + +- (NSCachedURLResponse *)cachedResponse +{ + return nil; +} + +- (void)startLoading +{ + self.clientRunLoop = CFRunLoopGetCurrent(); + NSURLRequest* request = self.request; + id client = self.client; + + if (!self.stub) + { + NSDictionary* userInfo = [NSDictionary dictionaryWithObjectsAndKeys: + @"It seems like the stub has been removed BEFORE the response had time to be sent.", + NSLocalizedFailureReasonErrorKey, + @"For more info, see https://github.com/AliSoftware/OHHTTPStubs/wiki/OHHTTPStubs-and-asynchronous-tests", + NSLocalizedRecoverySuggestionErrorKey, + request.URL, // Stop right here if request.URL is nil + NSURLErrorFailingURLErrorKey, + nil]; + NSError* error = [NSError errorWithDomain:@"OHHTTPStubs" code:500 userInfo:userInfo]; + [client URLProtocol:self didFailWithError:error]; + if (self.manager.afterStubFinishBlock) + { + self.manager.afterStubFinishBlock(request, self.stub, nil, error); + } + return; + } + + OHHTTPStubsResponse* responseStub = self.stub.responseBlock(request); + + if (self.manager.onStubActivationBlock) + { + self.manager.onStubActivationBlock(request, self.stub, responseStub); + } + + if (responseStub.error == nil) + { + NSHTTPURLResponse* urlResponse = [[NSHTTPURLResponse alloc] initWithURL:request.URL + statusCode:responseStub.statusCode + HTTPVersion:@"HTTP/1.1" + headerFields:responseStub.httpHeaders]; + + // Cookies handling + if (request.HTTPShouldHandleCookies && request.URL) + { + NSArray* cookies = [NSHTTPCookie cookiesWithResponseHeaderFields:responseStub.httpHeaders forURL:request.URL]; + if (cookies) + { + [NSHTTPCookieStorage.sharedHTTPCookieStorage setCookies:cookies forURL:request.URL mainDocumentURL:request.mainDocumentURL]; + } + } + + + NSString* redirectLocation = (responseStub.httpHeaders)[@"Location"]; + NSURL* redirectLocationURL; + if (redirectLocation) + { + redirectLocationURL = [NSURL URLWithString:redirectLocation]; + } + else + { + redirectLocationURL = nil; + } + [self executeOnClientRunLoopAfterDelay:responseStub.requestTime block:^{ + if (!self.stopped) + { + // Notify if a redirection occurred + if (((responseStub.statusCode > 300) && (responseStub.statusCode < 400)) && redirectLocationURL) + { + NSURLRequest* redirectRequest = [NSURLRequest requestWithURL:redirectLocationURL]; + [client URLProtocol:self wasRedirectedToRequest:redirectRequest redirectResponse:urlResponse]; + if (self.manager.onStubRedirectBlock) + { + self.manager.onStubRedirectBlock(request, redirectRequest, self.stub, responseStub); + } + } + + // Send the response (even for redirections) + [client URLProtocol:self didReceiveResponse:urlResponse cacheStoragePolicy:NSURLCacheStorageNotAllowed]; + if(responseStub.inputStream.streamStatus == NSStreamStatusNotOpen) + { + [responseStub.inputStream open]; + } + [self streamDataForClient:client + withStubResponse:responseStub + completion:^(NSError * error) + { + [responseStub.inputStream close]; + NSError *blockError = nil; + if (error==nil) + { + [client URLProtocolDidFinishLoading:self]; + } + else + { + [client URLProtocol:self didFailWithError:responseStub.error]; + blockError = responseStub.error; + } + if (self.manager.afterStubFinishBlock) + { + self.manager.afterStubFinishBlock(request, self.stub, responseStub, blockError); + } + }]; + } + }]; + } else { + // Send the canned error + [self executeOnClientRunLoopAfterDelay:responseStub.responseTime block:^{ + if (!self.stopped) + { + [client URLProtocol:self didFailWithError:responseStub.error]; + if (self.manager.afterStubFinishBlock) + { + self.manager.afterStubFinishBlock(request, self.stub, responseStub, responseStub.error); + } + } + }]; + } +} + +- (void)stopLoading +{ + self.stopped = YES; +} + +typedef struct { + NSTimeInterval slotTime; + double chunkSizePerSlot; + double cumulativeChunkSize; +} OHHTTPStubsStreamTimingInfo; + +- (void)streamDataForClient:(id)client + withStubResponse:(OHHTTPStubsResponse*)stubResponse + completion:(void(^)(NSError * error))completion +{ + if (!self.stopped) + { + if ((stubResponse.dataSize>0) && stubResponse.inputStream.hasBytesAvailable) + { + // Compute timing data once and for all for this stub + + OHHTTPStubsStreamTimingInfo timingInfo = { + .slotTime = kSlotTime, // Must be >0. We will send a chunk of data from the stream each 'slotTime' seconds + .cumulativeChunkSize = 0 + }; + + if(stubResponse.responseTime < 0) + { + // Bytes send each 'slotTime' seconds = Speed in KB/s * 1000 * slotTime in seconds + timingInfo.chunkSizePerSlot = (fabs(stubResponse.responseTime) * 1000) * timingInfo.slotTime; + } + else if (stubResponse.responseTime < kSlotTime) // includes case when responseTime == 0 + { + // We want to send the whole data quicker than the slotTime, so send it all in one chunk. + timingInfo.chunkSizePerSlot = stubResponse.dataSize; + timingInfo.slotTime = stubResponse.responseTime; + } + else + { + // Bytes send each 'slotTime' seconds = (Whole size in bytes / response time) * slotTime = speed in bps * slotTime in seconds + timingInfo.chunkSizePerSlot = ((stubResponse.dataSize/stubResponse.responseTime) * timingInfo.slotTime); + } + + [self streamDataForClient:client + fromStream:stubResponse.inputStream + timingInfo:timingInfo + completion:completion]; + } + else + { + [self executeOnClientRunLoopAfterDelay:stubResponse.responseTime block:^{ + if (completion && !self.stopped) + { + completion(nil); + } + }]; + } + } +} + +- (void) streamDataForClient:(id)client + fromStream:(NSInputStream*)inputStream + timingInfo:(OHHTTPStubsStreamTimingInfo)timingInfo + completion:(void(^)(NSError * error))completion +{ + NSParameterAssert(timingInfo.chunkSizePerSlot > 0); + + if (inputStream.hasBytesAvailable && (!self.stopped)) + { + // This is needed in case we computed a non-integer chunkSizePerSlot, to avoid cumulative errors + double cumulativeChunkSizeAfterRead = timingInfo.cumulativeChunkSize + timingInfo.chunkSizePerSlot; + NSUInteger chunkSizeToRead = floor(cumulativeChunkSizeAfterRead) - floor(timingInfo.cumulativeChunkSize); + timingInfo.cumulativeChunkSize = cumulativeChunkSizeAfterRead; + + if (chunkSizeToRead == 0) + { + // Nothing to read at this pass, but probably later + [self executeOnClientRunLoopAfterDelay:timingInfo.slotTime block:^{ + [self streamDataForClient:client fromStream:inputStream + timingInfo:timingInfo completion:completion]; + }]; + } else { + uint8_t* buffer = (uint8_t*)malloc(sizeof(uint8_t)*chunkSizeToRead); + NSInteger bytesRead = [inputStream read:buffer maxLength:chunkSizeToRead]; + if (bytesRead > 0) + { + NSData * data = [NSData dataWithBytes:buffer length:bytesRead]; + // Wait for 'slotTime' seconds before sending the chunk. + // If bytesRead < chunkSizePerSlot (because we are near the EOF), adjust slotTime proportionally to the bytes remaining + [self executeOnClientRunLoopAfterDelay:((double)bytesRead / (double)chunkSizeToRead) * timingInfo.slotTime block:^{ + [client URLProtocol:self didLoadData:data]; + [self streamDataForClient:client fromStream:inputStream + timingInfo:timingInfo completion:completion]; + }]; + } + else + { + if (completion) + { + // Note: We may also arrive here with no error if we were just at the end of the stream (EOF) + // In that case, hasBytesAvailable did return YES (because at the limit of OEF) but nothing were read (because EOF) + // But then in that case inputStream.streamError will be nil so that's cool, we won't return an error anyway + completion(inputStream.streamError); + } + } + free(buffer); + } + } + else + { + if (completion) + { + completion(nil); + } + } +} + +///////////////////////////////////////////// +// Delayed execution utility methods +///////////////////////////////////////////// + +- (void)executeOnClientRunLoopAfterDelay:(NSTimeInterval)delayInSeconds block:(dispatch_block_t)block +{ + dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); + dispatch_after(popTime, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + CFRunLoopPerformBlock(self.clientRunLoop, kCFRunLoopDefaultMode, block); + CFRunLoopWakeUp(self.clientRunLoop); + }); +} + +@end diff --git a/OHHTTPStubs/Sources/OHHTTPStubsTypes.h b/OHHTTPStubs/Sources/OHHTTPStubsTypes.h new file mode 100644 index 00000000..76e967b6 --- /dev/null +++ b/OHHTTPStubs/Sources/OHHTTPStubsTypes.h @@ -0,0 +1,39 @@ +// +// OHHTTPStubsTypes.h +// OHHTTPStubs +// +// Created by Nickolas Pohilets on 29.04.17. +// Copyright © 2017 AliSoftware. All rights reserved. +// + +#import +#import "OHHTTPStubsResponse.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef BOOL(^OHHTTPStubsTestBlock)(NSURLRequest* request); +typedef OHHTTPStubsResponse* __nonnull (^OHHTTPStubsResponseBlock)( NSURLRequest* request); + +/** + * This opaque type represents an installed stub and is used to uniquely + * identify a stub once it has been created. + * + * This type is returned by the `stubRequestsPassingTest:withStubResponse:` method + * so that you can later reference it and use this reference to remove the stub later. + * + * This type also let you add arbitrary metadata to a stub to differenciate it + * more easily when debugging. + */ +@protocol OHHTTPStubsDescriptor +/** + * An arbitrary name that you can set and get to describe your stub. + * Use it as your own convenience. + * + * This is especially useful if you dump all installed stubs using `allStubs` + * or if you want to log which stubs are being triggered using `onStubActivation:`. + */ +@property(nonatomic, strong, nullable) NSString* name; + +@end + +NS_ASSUME_NONNULL_END From 97567c6f434f92ca6f5f59ee34f00ff78fd38842 Mon Sep 17 00:00:00 2001 From: Nickolas Pohilets Date: Sun, 30 Apr 2017 00:01:42 +0200 Subject: [PATCH 3/8] Respecting +[OHHTTPStubs setEnabled:] for +[NSURLSessionConfiguration defaultSessionConfiguration] and +[NSURLSessionConfiguration ephemeralSessionConfiguration] --- .../OHHTTPStubs+NSURLSessionConfiguration.m | 8 +++-- OHHTTPStubs/Sources/OHHTTPStubs.m | 9 ++--- .../UnitTests/Test Suites/NSURLSessionTests.m | 35 ++++++++++++++++++- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/OHHTTPStubs/Sources/NSURLSession/OHHTTPStubs+NSURLSessionConfiguration.m b/OHHTTPStubs/Sources/NSURLSession/OHHTTPStubs+NSURLSessionConfiguration.m index 6e885152..8c329c8f 100644 --- a/OHHTTPStubs/Sources/NSURLSession/OHHTTPStubs+NSURLSessionConfiguration.m +++ b/OHHTTPStubs/Sources/NSURLSession/OHHTTPStubs+NSURLSessionConfiguration.m @@ -44,14 +44,18 @@ static NSURLSessionConfiguration* OHHTTPStubs_defaultSessionConfiguration(id self, SEL _cmd) { NSURLSessionConfiguration* config = orig_defaultSessionConfiguration(self,_cmd); // call original method - [OHHTTPStubs setEnabled:YES forSessionConfiguration:config]; //OHHTTPStubsAddProtocolClassToNSURLSessionConfiguration(config); + if ([OHHTTPStubs isEnabled]) { + [OHHTTPStubs setEnabled:YES forSessionConfiguration:config]; + } return config; } static NSURLSessionConfiguration* OHHTTPStubs_ephemeralSessionConfiguration(id self, SEL _cmd) { NSURLSessionConfiguration* config = orig_ephemeralSessionConfiguration(self,_cmd); // call original method - [OHHTTPStubs setEnabled:YES forSessionConfiguration:config]; //OHHTTPStubsAddProtocolClassToNSURLSessionConfiguration(config); + if ([OHHTTPStubs isEnabled]) { + [OHHTTPStubs setEnabled:YES forSessionConfiguration:config]; + } return config; } diff --git a/OHHTTPStubs/Sources/OHHTTPStubs.m b/OHHTTPStubs/Sources/OHHTTPStubs.m index d882dd88..dd01b839 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubs.m +++ b/OHHTTPStubs/Sources/OHHTTPStubs.m @@ -63,7 +63,8 @@ + (instancetype)sharedInstance static dispatch_once_t predicate; dispatch_once(&predicate, ^{ - sharedInstance = [[self alloc] initEnabled:YES]; + sharedInstance = [[self alloc] init]; + [sharedInstance setEnabled:YES]; }); return sharedInstance; } @@ -71,17 +72,13 @@ + (instancetype)sharedInstance //////////////////////////////////////////////////////////////////////////////// #pragma mark - Setup & Teardown -- (instancetype)initEnabled:(BOOL)enabled +- (instancetype)init { self = [super init]; if (self) { _stubDescriptors = [NSMutableArray array]; _protocolClass = [[OHHTTPStubsProtocolClassProxy alloc] initWithManager:self]; - _enabledState = enabled; - if (enabled) { - [self _setEnable:YES]; - } } return self; } diff --git a/OHHTTPStubs/UnitTests/Test Suites/NSURLSessionTests.m b/OHHTTPStubs/UnitTests/Test Suites/NSURLSessionTests.m index a5e95d30..79e87fa8 100644 --- a/OHHTTPStubs/UnitTests/Test Suites/NSURLSessionTests.m +++ b/OHHTTPStubs/UnitTests/Test Suites/NSURLSessionTests.m @@ -275,7 +275,40 @@ - (void)test_NSURLSessionEphemeralConfig } } -- (void)test_NSURLSessionDefaultConfig_Disabled +- (void)test_NSURLSessionEphemeralConfig_Disabled +{ + if ([NSURLSessionConfiguration class] && [NSURLSession class]) + { + BOOL wasEnabled = [OHHTTPStubs isEnabled]; + XCTAssert(wasEnabled, @"Stubs are expected to be on by default"); + [OHHTTPStubs setEnabled:NO]; + XCTAssert(![OHHTTPStubs isEnabled], @"isEnabled should report NO after turning off"); + NSURLSessionConfiguration* config = [NSURLSessionConfiguration ephemeralSessionConfiguration]; + [OHHTTPStubs setEnabled:YES]; + XCTAssert([OHHTTPStubs isEnabled], @"isEnabled should report YES after turning on"); + NSURLSession *session = [NSURLSession sessionWithConfiguration:config]; + + NSDictionary* json = @{@"Success": @"Yes"}; + [self _test_NSURLSession:session jsonForStub:json completion:^(NSError *errorResponse, id jsonResponse) { + // Stubs were disable for this session, so we should get an error instead of the stubs data + XCTAssertNotNil(errorResponse, @"Expected error but none found"); + XCTAssertNil(jsonResponse, @"Data should not have been received as stubs should be disabled"); + }]; + + [self _test_redirect_NSURLSession:session jsonForStub:json completion:^(NSError *errorResponse, NSHTTPURLResponse *redirectResponse, id jsonResponse) { + // Stubs were disable for this session, so we should get an error instead of the stubs data + XCTAssertNotNil(errorResponse, @"Expected error but none found"); + XCTAssertNil(redirectResponse, @"Redirect response should not have been received as stubs should be disabled"); + XCTAssertNil(jsonResponse, @"Data should not have been received as stubs should be disabled"); + }]; + } + else + { + NSLog(@"/!\\ Test skipped because the NSURLSession class is not available on this OS version. Run the tests a target with a more recent OS.\n"); + } +} + +- (void)test_NSURLSessionEphemeralConfig_DisabledForSession { if ([NSURLSessionConfiguration class] && [NSURLSession class]) { From 7b7d1fbe253ae842041b78be6d5f8faa4ffded36 Mon Sep 17 00:00:00 2001 From: Nickolas Pohilets Date: Sun, 30 Apr 2017 13:03:22 +0200 Subject: [PATCH 4/8] Opened instance methods in public interface --- OHHTTPStubs/Sources/OHHTTPStubs.h | 37 +++++++- OHHTTPStubs/Sources/OHHTTPStubs.m | 85 +++++++++++------ OHHTTPStubs/Sources/OHHTTPStubsTypes.h | 4 + .../UnitTests/Test Suites/NSURLSessionTests.m | 95 ++++++++++++++++--- 4 files changed, 180 insertions(+), 41 deletions(-) diff --git a/OHHTTPStubs/Sources/OHHTTPStubs.h b/OHHTTPStubs/Sources/OHHTTPStubs.h index 5005e88b..cef176ae 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubs.h +++ b/OHHTTPStubs/Sources/OHHTTPStubs.h @@ -38,6 +38,25 @@ NS_ASSUME_NONNULL_BEGIN */ @interface OHHTTPStubs : NSObject +/** + * Returns default instance that handles NSURLConnection and default NSURLSessionConfiguration + */ ++ (instancetype)defaultInstance; + +/** + * You can also create a new instance for more flexible configuration management. + * Multiple instances may co-exist at the same time. + * + * Note that if +[OHHTTPStubs isEnabled] is YES, then all session configurations created + * using defaultSessionConfiguration or ephemeralSessionConfiguration are by default + * managed by shared instance. + * + * So, if you want to use custom instance of OHHTTPStubs for session configuration, + * you should either disable default instance for that session configuration, or + * make sure that sets of stub tests of different instances are mututally exclusive. + */ +- (instancetype)init; + //////////////////////////////////////////////////////////////////////////////// #pragma mark - Adding & Removing stubs @@ -63,6 +82,9 @@ NS_ASSUME_NONNULL_BEGIN +(id)stubRequestsPassingTest:(OHHTTPStubsTestBlock)testBlock withStubResponse:(OHHTTPStubsResponseBlock)responseBlock; +-(id)stubRequestsPassingTest:(OHHTTPStubsTestBlock)testBlock + withStubResponse:(OHHTTPStubsResponseBlock)responseBlock; + /** * Remove a stub from the list of stubs * @@ -74,10 +96,13 @@ NS_ASSUME_NONNULL_BEGIN */ +(BOOL)removeStub:(id)stubDesc; +-(BOOL)removeStub:(id)stubDesc; + /** * Remove all the stubs from the stubs list. */ +(void)removeAllStubs; +-(void)removeAllStubs; //////////////////////////////////////////////////////////////////////////////// #pragma mark - Disabling & Re-Enabling stubs @@ -126,6 +151,7 @@ NS_ASSUME_NONNULL_BEGIN * created sessions. */ + (void)setEnabled:(BOOL)enabled forSessionConfiguration:(NSURLSessionConfiguration *)sessionConfig; +- (void)setEnabled:(BOOL)enabled forSessionConfiguration:(NSURLSessionConfiguration *)sessionConfig; /** * Whether stubs are enabled or disabled on a given `NSURLSessionConfiguration` @@ -135,6 +161,7 @@ NS_ASSUME_NONNULL_BEGIN * @return If `YES` the stubs are enabled for sessionConfig. If `NO` then the stubs are disabled */ + (BOOL)isEnabledForSessionConfiguration:(NSURLSessionConfiguration *)sessionConfig; +- (BOOL)isEnabledForSessionConfiguration:(NSURLSessionConfiguration *)sessionConfig; #endif #pragma mark - Debug Methods @@ -145,6 +172,7 @@ NS_ASSUME_NONNULL_BEGIN * @return An array of `id` objects currently installed. Useful for debug. */ +(NSArray*)allStubs; +-(NSArray*)allStubs; /** * Setup a block to be called each time a stub is triggered. @@ -155,7 +183,8 @@ NS_ASSUME_NONNULL_BEGIN * @param block The block to call each time a request is being stubbed by OHHTTPStubs. * Set it to `nil` to do nothing. Defaults is `nil`. */ -+(void)onStubActivation:( nullable void(^)(NSURLRequest* request, id stub, OHHTTPStubsResponse* responseStub) )block; ++(void)onStubActivation:(nullable OHHTTPStubsActivationBlock)block; +-(void)onStubActivation:(nullable OHHTTPStubsActivationBlock)block; /** * Setup a block to be called whenever OHHTTPStubs encounters a redirect request. @@ -163,7 +192,8 @@ NS_ASSUME_NONNULL_BEGIN * @param block The block to call each time a redirect request is being stubbed by OHHTTPStubs. * Set it to `nil` to do nothing. Defaults is `nil`. */ -+(void)onStubRedirectResponse:( nullable void(^)(NSURLRequest* request, NSURLRequest* redirectRequest, id stub, OHHTTPStubsResponse* responseStub) )block; ++(void)onStubRedirectResponse:(nullable OHHTTPStubsRedirectBlock)block; +-(void)onStubRedirectResponse:(nullable OHHTTPStubsRedirectBlock)block; /** * Setup a block to be called each time a stub finishes. Useful if stubs take an insignificant amount @@ -173,7 +203,8 @@ NS_ASSUME_NONNULL_BEGIN * @param block The block to call each time a request is finished being stubbed by OHHTTPStubs. * Set it to `nil` to do nothing. Defaults is `nil`. */ -+(void)afterStubFinish:( nullable void(^)(NSURLRequest* request, id stub, OHHTTPStubsResponse* responseStub, NSError *error) )block; ++(void)afterStubFinish:(nullable OHHTTPStubsFinishBlock)block; +-(void)afterStubFinish:(nullable OHHTTPStubsFinishBlock)block; @end diff --git a/OHHTTPStubs/Sources/OHHTTPStubs.m b/OHHTTPStubs/Sources/OHHTTPStubs.m index dd01b839..31558f9e 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubs.m +++ b/OHHTTPStubs/Sources/OHHTTPStubs.m @@ -38,8 +38,6 @@ @interface OHHTTPStubs() -+ (instancetype)sharedInstance; - @property(atomic, strong) id protocolClass; @property(atomic, copy) NSMutableArray* stubDescriptors; @property(atomic, assign) BOOL enabledState; @@ -57,16 +55,16 @@ @implementation OHHTTPStubs //////////////////////////////////////////////////////////////////////////////// #pragma mark - Singleton methods -+ (instancetype)sharedInstance ++ (instancetype)defaultInstance { - static OHHTTPStubs *sharedInstance = nil; + static OHHTTPStubs *defaultInstance = nil; static dispatch_once_t predicate; dispatch_once(&predicate, ^{ - sharedInstance = [[self alloc] init]; - [sharedInstance setEnabled:YES]; + defaultInstance = [[self alloc] init]; + [defaultInstance setEnabled:YES]; }); - return sharedInstance; + return defaultInstance; } //////////////////////////////////////////////////////////////////////////////// @@ -98,43 +96,40 @@ - (void)dealloc +(id)stubRequestsPassingTest:(OHHTTPStubsTestBlock)testBlock withStubResponse:(OHHTTPStubsResponseBlock)responseBlock { - OHHTTPStubsDescriptor* stub = [OHHTTPStubsDescriptor stubDescriptorWithTestBlock:testBlock - responseBlock:responseBlock]; - [OHHTTPStubs.sharedInstance addStub:stub]; - return stub; + return [OHHTTPStubs.defaultInstance stubRequestsPassingTest:testBlock withStubResponse:responseBlock]; } +(BOOL)removeStub:(id)stubDesc { - return [OHHTTPStubs.sharedInstance removeStub:stubDesc]; + return [OHHTTPStubs.defaultInstance removeStub:stubDesc]; } +(void)removeAllStubs { - [OHHTTPStubs.sharedInstance removeAllStubs]; + [OHHTTPStubs.defaultInstance removeAllStubs]; } #pragma mark > Disabling & Re-Enabling stubs +(void)setEnabled:(BOOL)enabled { - [OHHTTPStubs.sharedInstance setEnabled:enabled]; + [OHHTTPStubs.defaultInstance setEnabled:enabled]; } +(BOOL)isEnabled { - return OHHTTPStubs.sharedInstance.isEnabled; + return OHHTTPStubs.defaultInstance.isEnabled; } #if defined(__IPHONE_7_0) || defined(__MAC_10_9) + (void)setEnabled:(BOOL)enable forSessionConfiguration:(NSURLSessionConfiguration*)sessionConfig { - [OHHTTPStubs.sharedInstance setEnabled:enable forSessionConfiguration:sessionConfig]; + [OHHTTPStubs.defaultInstance setEnabled:enable forSessionConfiguration:sessionConfig]; } + (BOOL)isEnabledForSessionConfiguration:(NSURLSessionConfiguration *)sessionConfig { - return [OHHTTPStubs.sharedInstance isEnabledForSessionConfiguration:sessionConfig]; + return [OHHTTPStubs.defaultInstance isEnabledForSessionConfiguration:sessionConfig]; } #endif @@ -142,26 +137,25 @@ + (BOOL)isEnabledForSessionConfiguration:(NSURLSessionConfiguration *)sessionCon +(NSArray*)allStubs { - return [OHHTTPStubs.sharedInstance stubDescriptors]; + return [OHHTTPStubs.defaultInstance allStubs]; } -+(void)onStubActivation:( nullable void(^)(NSURLRequest* request, id stub, OHHTTPStubsResponse* responseStub) )block ++(void)onStubActivation:(nullable OHHTTPStubsActivationBlock)block { - [OHHTTPStubs.sharedInstance setOnStubActivationBlock:block]; + [OHHTTPStubs.defaultInstance setOnStubActivationBlock:block]; } -+(void)onStubRedirectResponse:( nullable void(^)(NSURLRequest* request, NSURLRequest* redirectRequest, id stub, OHHTTPStubsResponse* responseStub) )block ++(void)onStubRedirectResponse:(nullable OHHTTPStubsRedirectBlock)block { - [OHHTTPStubs.sharedInstance setOnStubRedirectBlock:block]; + [OHHTTPStubs.defaultInstance setOnStubRedirectBlock:block]; } -+(void)afterStubFinish:( nullable void(^)(NSURLRequest* request, id stub, OHHTTPStubsResponse* responseStub, NSError* error) )block ++(void)afterStubFinish:(nullable OHHTTPStubsFinishBlock)block { - [OHHTTPStubs.sharedInstance setAfterStubFinishBlock:block]; + [OHHTTPStubs.defaultInstance setAfterStubFinishBlock:block]; } - //////////////////////////////////////////////////////////////////////////////// #pragma mark - Private instance methods @@ -196,6 +190,11 @@ -(void)_setEnable:(BOOL)enable } } +//////////////////////////////////////////////////////////////////////////////// +#pragma mark - Public instance methods + +#pragma mark > Disabling & Re-Enabling stubs + #if defined(__IPHONE_7_0) || defined(__MAC_10_9) - (void)setEnabled:(BOOL)enable forSessionConfiguration:(NSURLSessionConfiguration*)sessionConfig { @@ -243,12 +242,18 @@ - (BOOL)isEnabledForSessionConfiguration:(NSURLSessionConfiguration *)sessionCon } #endif --(void)addStub:(OHHTTPStubsDescriptor*)stubDesc +#pragma mark > Adding & Removing stubs + +- (id)stubRequestsPassingTest:(OHHTTPStubsTestBlock)testBlock + withStubResponse:(OHHTTPStubsResponseBlock)responseBlock { + OHHTTPStubsDescriptor* stub = [OHHTTPStubsDescriptor stubDescriptorWithTestBlock:testBlock + responseBlock:responseBlock]; @synchronized(_stubDescriptors) { - [_stubDescriptors addObject:stubDesc]; + [_stubDescriptors addObject:stub]; } + return stub; } -(BOOL)removeStub:(id)stubDesc @@ -270,6 +275,32 @@ -(void)removeAllStubs } } +#pragma mark > Debug Methods + +-(NSArray*)allStubs +{ + return self.stubDescriptors; +} + +-(void)onStubActivation:(nullable OHHTTPStubsActivationBlock)block +{ + self.onStubActivationBlock = block; +} + +-(void)onStubRedirectResponse:(nullable OHHTTPStubsRedirectBlock)block +{ + self.onStubRedirectBlock = block; +} + +-(void)afterStubFinish:(nullable OHHTTPStubsFinishBlock)block +{ + self.afterStubFinishBlock = block; +} + + +//////////////////////////////////////////////////////////////////////////////// +#pragma mark - OHHTTPStubsManager + - (OHHTTPStubsDescriptor*)firstStubPassingTestForRequest:(NSURLRequest*)request { OHHTTPStubsDescriptor* foundStub = nil; diff --git a/OHHTTPStubs/Sources/OHHTTPStubsTypes.h b/OHHTTPStubs/Sources/OHHTTPStubsTypes.h index 76e967b6..f4e25c7f 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubsTypes.h +++ b/OHHTTPStubs/Sources/OHHTTPStubsTypes.h @@ -36,4 +36,8 @@ typedef OHHTTPStubsResponse* __nonnull (^OHHTTPStubsResponseBlock)( NSURLRequest @end +typedef void(^OHHTTPStubsActivationBlock)(NSURLRequest* request, id stub, OHHTTPStubsResponse* responseStub); +typedef void(^OHHTTPStubsRedirectBlock)(NSURLRequest* request, NSURLRequest* redirectRequest, id stub, OHHTTPStubsResponse* responseStub); +typedef void(^OHHTTPStubsFinishBlock)(NSURLRequest* request, id stub, OHHTTPStubsResponse* responseStub, NSError *error); + NS_ASSUME_NONNULL_END diff --git a/OHHTTPStubs/UnitTests/Test Suites/NSURLSessionTests.m b/OHHTTPStubs/UnitTests/Test Suites/NSURLSessionTests.m index 79e87fa8..839cbade 100644 --- a/OHHTTPStubs/UnitTests/Test Suites/NSURLSessionTests.m +++ b/OHHTTPStubs/UnitTests/Test Suites/NSURLSessionTests.m @@ -59,18 +59,33 @@ - (void)setUp - (void)_test_NSURLSession:(NSURLSession*)session jsonForStub:(id)json completion:(void(^)(NSError* errorResponse,id jsonResponse))completion +{ + [self _test_NSURLSession:session jsonForStub:json instance:nil completion:completion]; +} + +- (void)_test_NSURLSession:(NSURLSession*)session + jsonForStub:(id)json + instance:(OHHTTPStubs* _Nullable)instance + completion:(void(^)(NSError* errorResponse,id jsonResponse))completion { if ([NSURLSession class]) { static const NSTimeInterval kRequestTime = 0.0; static const NSTimeInterval kResponseTime = 0.2; - [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { + OHHTTPStubsTestBlock test = ^BOOL(NSURLRequest *request) { return YES; - } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) { + }; + OHHTTPStubsResponseBlock response = ^OHHTTPStubsResponse *(NSURLRequest *request) { return [[OHHTTPStubsResponse responseWithJSONObject:json statusCode:200 headers:nil] requestTime:kRequestTime responseTime:kResponseTime]; - }]; + }; + + if (instance) { + [instance stubRequestsPassingTest:test withStubResponse:response]; + } else { + [OHHTTPStubs stubRequestsPassingTest:test withStubResponse:response]; + } XCTestExpectation* expectation = [self expectationWithDescription:@"NSURLSessionDataTask completed"]; @@ -106,26 +121,44 @@ - (void)_test_NSURLSession:(NSURLSession*)session - (void)_test_redirect_NSURLSession:(NSURLSession*)session jsonForStub:(id)json completion:(void(^)(NSError* errorResponse, NSHTTPURLResponse *response, id jsonResponse))completion +{ + [self _test_redirect_NSURLSession:session jsonForStub:json instance:nil completion:completion]; +} + +- (void)_test_redirect_NSURLSession:(NSURLSession*)session + jsonForStub:(id)json + instance:(OHHTTPStubs* _Nullable)instance + completion:(void(^)(NSError* errorResponse, NSHTTPURLResponse *response, id jsonResponse))completion { if ([NSURLSession class]) { static const NSTimeInterval kRequestTime = 0.2; static const NSTimeInterval kResponseTime = 0.2; - - [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { + + OHHTTPStubsTestBlock test1 = ^BOOL(NSURLRequest *request) { return [[[request URL] path] isEqualToString:@""]; - } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) { + }; + OHHTTPStubsResponseBlock response1 = ^OHHTTPStubsResponse *(NSURLRequest *request) { NSDictionary *headers = @{ @"Location": @"foo://unknownhost:666/elsewhere" }; return [[OHHTTPStubsResponse responseWithData:[[NSData alloc] init] statusCode:301 headers:headers] requestTime:kRequestTime responseTime:kResponseTime]; - }]; - - [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { + }; + + OHHTTPStubsTestBlock test2 = ^BOOL(NSURLRequest *request) { return [[[request URL] path] isEqualToString:@"/elsewhere"]; - } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) { + }; + OHHTTPStubsResponseBlock response2 = ^OHHTTPStubsResponse *(NSURLRequest *request) { return [[OHHTTPStubsResponse responseWithJSONObject:json statusCode:200 headers:nil] requestTime:kRequestTime responseTime:kResponseTime]; - }]; + }; + + if (instance) { + [instance stubRequestsPassingTest:test1 withStubResponse:response1]; + [instance stubRequestsPassingTest:test2 withStubResponse:response2]; + } else { + [OHHTTPStubs stubRequestsPassingTest:test1 withStubResponse:response1]; + [OHHTTPStubs stubRequestsPassingTest:test2 withStubResponse:response2]; + } XCTestExpectation* expectation = [self expectationWithDescription:@"NSURLSessionDataTask completed"]; @@ -250,6 +283,46 @@ - (void)test_NSURLSessionDefaultConfig_notFollowingRedirects } } +- (void)test_NSURLSessionDefaultConfig_customInstance +{ + if ([NSURLSessionConfiguration class] && [NSURLSession class]) + { + NSURLSessionConfiguration* config = [NSURLSessionConfiguration defaultSessionConfiguration]; + [OHHTTPStubs setEnabled:NO forSessionConfiguration:config]; + + OHHTTPStubs* custom = [OHHTTPStubs new]; + [custom setEnabled:YES forSessionConfiguration:config]; + + NSDictionary* defaultJSON = @{@"Failure": @"Yes"}; + NSDictionary* customJSON = @{@"Success": @"Yes"}; + [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest* request) { + return YES; + } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) { + return [OHHTTPStubsResponse responseWithJSONObject:defaultJSON + statusCode:200 + headers:nil]; + }]; + + + NSURLSession *session = [NSURLSession sessionWithConfiguration:config]; + + [self _test_NSURLSession:session jsonForStub:customJSON instance:custom completion:^(NSError *errorResponse, id jsonResponse) { + XCTAssertNil(errorResponse, @"Unexpected error"); + XCTAssertEqualObjects(jsonResponse, customJSON, @"Unexpected data received"); + }]; + + [self _test_redirect_NSURLSession:session jsonForStub:customJSON instance:custom completion:^(NSError *errorResponse, NSHTTPURLResponse *redirectResponse, id jsonResponse) { + XCTAssertNil(errorResponse, @"Unexpected error"); + XCTAssertNil(redirectResponse, @"Unexpected redirect response received"); + XCTAssertEqualObjects(jsonResponse, customJSON, @"Unexpected data received"); + }]; + } + else + { + NSLog(@"/!\\ Test skipped because the NSURLSession class is not available on this OS version. Run the tests a target with a more recent OS.\n"); + } +} + - (void)test_NSURLSessionEphemeralConfig { if ([NSURLSessionConfiguration class] && [NSURLSession class]) From e651800758a43fc61d9a8201831e4813b8212454 Mon Sep 17 00:00:00 2001 From: Nickolas Pohilets Date: Sun, 30 Apr 2017 13:15:27 +0200 Subject: [PATCH 5/8] Bumped version in the OHHTTPStubs.podspec and added entry to the CHANGELOG.md --- CHANGELOG.md | 5 +++++ Examples/ObjC/Podfile.lock | 16 ++++++++-------- .../Local Podspecs/OHHTTPStubs.podspec.json | 4 ++-- Examples/ObjC/Pods/Manifest.lock | 16 ++++++++-------- Examples/Swift/Podfile.lock | 18 +++++++++--------- .../Local Podspecs/OHHTTPStubs.podspec.json | 4 ++-- Examples/Swift/Pods/Manifest.lock | 18 +++++++++--------- .../OHHTTPStubs/Info.plist | 2 +- OHHTTPStubs.podspec | 2 +- 9 files changed, 45 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c4d01ae..c1fa853f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # OHHTTPStubs — CHANGELOG +## [6.1.0](https://github.com/AliSoftware/OHHTTPStubs/releases/tag/6.1.0) + +* Enabled creating multiple instances of OHHTTPStubs to be able to have `NSURLSession`'s with different stub configurations + [@nickolas-pohilets](https://github.com/nickolas-pohilets) + ## [6.0.0](https://github.com/AliSoftware/OHHTTPStubs/releases/tag/6.0.0) * Made Swift 3 the default. `master` is now compatible with 3.0 and 3.1. diff --git a/Examples/ObjC/Podfile.lock b/Examples/ObjC/Podfile.lock index 6168855b..2d755bdd 100644 --- a/Examples/ObjC/Podfile.lock +++ b/Examples/ObjC/Podfile.lock @@ -1,17 +1,17 @@ PODS: - - OHHTTPStubs (6.0.0): - - OHHTTPStubs/Default (= 6.0.0) - - OHHTTPStubs/Core (6.0.0) - - OHHTTPStubs/Default (6.0.0): + - OHHTTPStubs (6.1.0): + - OHHTTPStubs/Default (= 6.1.0) + - OHHTTPStubs/Core (6.1.0) + - OHHTTPStubs/Default (6.1.0): - OHHTTPStubs/Core - OHHTTPStubs/JSON - OHHTTPStubs/NSURLSession - OHHTTPStubs/OHPathHelpers - - OHHTTPStubs/JSON (6.0.0): + - OHHTTPStubs/JSON (6.1.0): - OHHTTPStubs/Core - - OHHTTPStubs/NSURLSession (6.0.0): + - OHHTTPStubs/NSURLSession (6.1.0): - OHHTTPStubs/Core - - OHHTTPStubs/OHPathHelpers (6.0.0) + - OHHTTPStubs/OHPathHelpers (6.1.0) DEPENDENCIES: - OHHTTPStubs (from `../..`) @@ -21,7 +21,7 @@ EXTERNAL SOURCES: :path: ../.. SPEC CHECKSUMS: - OHHTTPStubs: 5a78fe08e8f13065df05203a1f8f56b4a243ee17 + OHHTTPStubs: 63a88f42fd6c81ea99a037d8ceb01711b51af35e PODFILE CHECKSUM: 3b00a315b869401f03c1a7c408a9754a8e4c62d8 diff --git a/Examples/ObjC/Pods/Local Podspecs/OHHTTPStubs.podspec.json b/Examples/ObjC/Pods/Local Podspecs/OHHTTPStubs.podspec.json index 2bf7f5e3..89d43365 100644 --- a/Examples/ObjC/Pods/Local Podspecs/OHHTTPStubs.podspec.json +++ b/Examples/ObjC/Pods/Local Podspecs/OHHTTPStubs.podspec.json @@ -1,6 +1,6 @@ { "name": "OHHTTPStubs", - "version": "6.0.0", + "version": "6.1.0", "summary": "Framework to stub your network requests like HTTP and help you write network unit tests with XCTest.", "description": "A class to stub network requests easily:\n\n * Test your apps with fake network data (stubbed from file)\n * You can also customize your response headers and status code\n * Use customized stubs depending on the requests\n * Use custom response time to simulate slow network.\n * This works with any request (HTTP, HTTPS, or any protocol) sent using\n the iOS URL Loading System (NSURLConnection, NSURLSession, AFNetworking, …)\n * This is really useful in unit testing, when you need to test network features\n but don't want to hit the real network and fake some response data instead.\n * Has useful convenience methods to stub JSON content or fixture from a file\n * Compatible with Swift", "homepage": "https://github.com/AliSoftware/OHHTTPStubs", @@ -10,7 +10,7 @@ }, "source": { "git": "https://github.com/AliSoftware/OHHTTPStubs.git", - "tag": "6.0.0" + "tag": "6.1.0" }, "frameworks": [ "Foundation", diff --git a/Examples/ObjC/Pods/Manifest.lock b/Examples/ObjC/Pods/Manifest.lock index 6168855b..2d755bdd 100644 --- a/Examples/ObjC/Pods/Manifest.lock +++ b/Examples/ObjC/Pods/Manifest.lock @@ -1,17 +1,17 @@ PODS: - - OHHTTPStubs (6.0.0): - - OHHTTPStubs/Default (= 6.0.0) - - OHHTTPStubs/Core (6.0.0) - - OHHTTPStubs/Default (6.0.0): + - OHHTTPStubs (6.1.0): + - OHHTTPStubs/Default (= 6.1.0) + - OHHTTPStubs/Core (6.1.0) + - OHHTTPStubs/Default (6.1.0): - OHHTTPStubs/Core - OHHTTPStubs/JSON - OHHTTPStubs/NSURLSession - OHHTTPStubs/OHPathHelpers - - OHHTTPStubs/JSON (6.0.0): + - OHHTTPStubs/JSON (6.1.0): - OHHTTPStubs/Core - - OHHTTPStubs/NSURLSession (6.0.0): + - OHHTTPStubs/NSURLSession (6.1.0): - OHHTTPStubs/Core - - OHHTTPStubs/OHPathHelpers (6.0.0) + - OHHTTPStubs/OHPathHelpers (6.1.0) DEPENDENCIES: - OHHTTPStubs (from `../..`) @@ -21,7 +21,7 @@ EXTERNAL SOURCES: :path: ../.. SPEC CHECKSUMS: - OHHTTPStubs: 5a78fe08e8f13065df05203a1f8f56b4a243ee17 + OHHTTPStubs: 63a88f42fd6c81ea99a037d8ceb01711b51af35e PODFILE CHECKSUM: 3b00a315b869401f03c1a7c408a9754a8e4c62d8 diff --git a/Examples/Swift/Podfile.lock b/Examples/Swift/Podfile.lock index 6561d3df..dd0dfe25 100644 --- a/Examples/Swift/Podfile.lock +++ b/Examples/Swift/Podfile.lock @@ -1,18 +1,18 @@ PODS: - - OHHTTPStubs (6.0.0): - - OHHTTPStubs/Default (= 6.0.0) - - OHHTTPStubs/Core (6.0.0) - - OHHTTPStubs/Default (6.0.0): + - OHHTTPStubs (6.1.0): + - OHHTTPStubs/Default (= 6.1.0) + - OHHTTPStubs/Core (6.1.0) + - OHHTTPStubs/Default (6.1.0): - OHHTTPStubs/Core - OHHTTPStubs/JSON - OHHTTPStubs/NSURLSession - OHHTTPStubs/OHPathHelpers - - OHHTTPStubs/JSON (6.0.0): + - OHHTTPStubs/JSON (6.1.0): - OHHTTPStubs/Core - - OHHTTPStubs/NSURLSession (6.0.0): + - OHHTTPStubs/NSURLSession (6.1.0): - OHHTTPStubs/Core - - OHHTTPStubs/OHPathHelpers (6.0.0) - - OHHTTPStubs/Swift (6.0.0): + - OHHTTPStubs/OHPathHelpers (6.1.0) + - OHHTTPStubs/Swift (6.1.0): - OHHTTPStubs/Default DEPENDENCIES: @@ -24,7 +24,7 @@ EXTERNAL SOURCES: :path: ../.. SPEC CHECKSUMS: - OHHTTPStubs: 5a78fe08e8f13065df05203a1f8f56b4a243ee17 + OHHTTPStubs: 63a88f42fd6c81ea99a037d8ceb01711b51af35e PODFILE CHECKSUM: 7da7c441ea9ff6f06b633c908b7a7294805f5602 diff --git a/Examples/Swift/Pods/Local Podspecs/OHHTTPStubs.podspec.json b/Examples/Swift/Pods/Local Podspecs/OHHTTPStubs.podspec.json index 2bf7f5e3..89d43365 100644 --- a/Examples/Swift/Pods/Local Podspecs/OHHTTPStubs.podspec.json +++ b/Examples/Swift/Pods/Local Podspecs/OHHTTPStubs.podspec.json @@ -1,6 +1,6 @@ { "name": "OHHTTPStubs", - "version": "6.0.0", + "version": "6.1.0", "summary": "Framework to stub your network requests like HTTP and help you write network unit tests with XCTest.", "description": "A class to stub network requests easily:\n\n * Test your apps with fake network data (stubbed from file)\n * You can also customize your response headers and status code\n * Use customized stubs depending on the requests\n * Use custom response time to simulate slow network.\n * This works with any request (HTTP, HTTPS, or any protocol) sent using\n the iOS URL Loading System (NSURLConnection, NSURLSession, AFNetworking, …)\n * This is really useful in unit testing, when you need to test network features\n but don't want to hit the real network and fake some response data instead.\n * Has useful convenience methods to stub JSON content or fixture from a file\n * Compatible with Swift", "homepage": "https://github.com/AliSoftware/OHHTTPStubs", @@ -10,7 +10,7 @@ }, "source": { "git": "https://github.com/AliSoftware/OHHTTPStubs.git", - "tag": "6.0.0" + "tag": "6.1.0" }, "frameworks": [ "Foundation", diff --git a/Examples/Swift/Pods/Manifest.lock b/Examples/Swift/Pods/Manifest.lock index 6561d3df..dd0dfe25 100644 --- a/Examples/Swift/Pods/Manifest.lock +++ b/Examples/Swift/Pods/Manifest.lock @@ -1,18 +1,18 @@ PODS: - - OHHTTPStubs (6.0.0): - - OHHTTPStubs/Default (= 6.0.0) - - OHHTTPStubs/Core (6.0.0) - - OHHTTPStubs/Default (6.0.0): + - OHHTTPStubs (6.1.0): + - OHHTTPStubs/Default (= 6.1.0) + - OHHTTPStubs/Core (6.1.0) + - OHHTTPStubs/Default (6.1.0): - OHHTTPStubs/Core - OHHTTPStubs/JSON - OHHTTPStubs/NSURLSession - OHHTTPStubs/OHPathHelpers - - OHHTTPStubs/JSON (6.0.0): + - OHHTTPStubs/JSON (6.1.0): - OHHTTPStubs/Core - - OHHTTPStubs/NSURLSession (6.0.0): + - OHHTTPStubs/NSURLSession (6.1.0): - OHHTTPStubs/Core - - OHHTTPStubs/OHPathHelpers (6.0.0) - - OHHTTPStubs/Swift (6.0.0): + - OHHTTPStubs/OHPathHelpers (6.1.0) + - OHHTTPStubs/Swift (6.1.0): - OHHTTPStubs/Default DEPENDENCIES: @@ -24,7 +24,7 @@ EXTERNAL SOURCES: :path: ../.. SPEC CHECKSUMS: - OHHTTPStubs: 5a78fe08e8f13065df05203a1f8f56b4a243ee17 + OHHTTPStubs: 63a88f42fd6c81ea99a037d8ceb01711b51af35e PODFILE CHECKSUM: 7da7c441ea9ff6f06b633c908b7a7294805f5602 diff --git a/Examples/Swift/Pods/Target Support Files/OHHTTPStubs/Info.plist b/Examples/Swift/Pods/Target Support Files/OHHTTPStubs/Info.plist index e92eb785..2eb204d0 100644 --- a/Examples/Swift/Pods/Target Support Files/OHHTTPStubs/Info.plist +++ b/Examples/Swift/Pods/Target Support Files/OHHTTPStubs/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 6.0.0 + 6.1.0 CFBundleSignature ???? CFBundleVersion diff --git a/OHHTTPStubs.podspec b/OHHTTPStubs.podspec index 7dfa770b..2d231018 100644 --- a/OHHTTPStubs.podspec +++ b/OHHTTPStubs.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "OHHTTPStubs" - s.version = "6.0.0" + s.version = "6.1.0" s.summary = "Framework to stub your network requests like HTTP and help you write network unit tests with XCTest." s.description = <<-DESC.gsub(/^ +\|/,'') From 1b7be6dcd1a902753455aebd90ce4448c20762b4 Mon Sep 17 00:00:00 2001 From: Nickolas Pohilets Date: Sun, 30 Apr 2017 19:33:56 +0200 Subject: [PATCH 6/8] Added comments about implementation details and did some minor code clean-ups. --- OHHTTPStubs/Sources/OHHTTPStubs.m | 8 +++++--- OHHTTPStubs/Sources/OHHTTPStubsProtocol.h | 2 ++ OHHTTPStubs/Sources/OHHTTPStubsProtocol.m | 10 ++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/OHHTTPStubs/Sources/OHHTTPStubs.m b/OHHTTPStubs/Sources/OHHTTPStubs.m index 31558f9e..75f1a768 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubs.m +++ b/OHHTTPStubs/Sources/OHHTTPStubs.m @@ -76,6 +76,8 @@ - (instancetype)init if (self) { _stubDescriptors = [NSMutableArray array]; + // We create exactly one instance of class proxy per instance of OHHTTPStubs + // This eliminates the need in implementning hashing and equality in OHHTTPStubsProtocolClassProxy _protocolClass = [[OHHTTPStubsProtocolClassProxy alloc] initWithManager:self]; } return self; @@ -142,17 +144,17 @@ +(NSArray*)allStubs +(void)onStubActivation:(nullable OHHTTPStubsActivationBlock)block { - [OHHTTPStubs.defaultInstance setOnStubActivationBlock:block]; + [OHHTTPStubs.defaultInstance onStubActivation:block]; } +(void)onStubRedirectResponse:(nullable OHHTTPStubsRedirectBlock)block { - [OHHTTPStubs.defaultInstance setOnStubRedirectBlock:block]; + [OHHTTPStubs.defaultInstance onStubRedirectResponse:block]; } +(void)afterStubFinish:(nullable OHHTTPStubsFinishBlock)block { - [OHHTTPStubs.defaultInstance setAfterStubFinishBlock:block]; + [OHHTTPStubs.defaultInstance afterStubFinish:block]; } diff --git a/OHHTTPStubs/Sources/OHHTTPStubsProtocol.h b/OHHTTPStubs/Sources/OHHTTPStubsProtocol.h index b1b4fc0c..460c9b58 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubsProtocol.h +++ b/OHHTTPStubs/Sources/OHHTTPStubsProtocol.h @@ -21,12 +21,14 @@ NS_ASSUME_NONNULL_BEGIN @end +/// Proxy for the class object of the OHHTTPStubsProtocol that injects OHHTTPStubsManager into created instance of OHHTTPStubsProtocol @interface OHHTTPStubsProtocolClassProxy : NSProxy - (instancetype)initWithManager:(id)manager; @end +/// Proxy for the instance of OHHTTPStubsProtocol that was allocated, but not yet initialized. @interface OHHTTPStubsProtocolInstanceProxy : NSProxy - (instancetype)initWithManager:(id)manager; diff --git a/OHHTTPStubs/Sources/OHHTTPStubsProtocol.m b/OHHTTPStubs/Sources/OHHTTPStubsProtocol.m index 62062078..894252f6 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubsProtocol.m +++ b/OHHTTPStubs/Sources/OHHTTPStubsProtocol.m @@ -62,6 +62,8 @@ - (NSMethodSignature *)methodSignatureForSelector:(SEL)sel { } + (BOOL)resolveInstanceMethod:(SEL)sel { + // This copies some NSURLSessionTask-related methods from NSURLProtocol. + // Their default implementation forwards to methds that accept NSURLRequest. Method m = class_getClassMethod(OHHTTPStubsProtocol.self, sel); if (!m) { return NO; @@ -84,6 +86,8 @@ - (id)initWithRequest:(NSURLRequest *)request cachedResponse:(NSCachedURLRespons } - (Class)class { + // Proper implementation probably should return a parent instance of OHHTTPStubsProtocolClassProxy + // But this method is not called, so let's avoid writing dead code. NSAssert(NO, @"-[OHHTTPStubsProtocolInstanceProxy class] is not implemented"); return [OHHTTPStubsProtocol class]; } @@ -101,6 +105,8 @@ - (NSMethodSignature *)methodSignatureForSelector:(SEL)sel { } + (BOOL)resolveInstanceMethod:(SEL)sel { + // This copies some NSURLSessionTask-related methods from NSURLProtocol. + // Their default implementation forwards to methds that accept NSURLRequest. Method m = class_getInstanceMethod(OHHTTPStubsProtocol.self, sel); if (!m) { return NO; @@ -125,10 +131,6 @@ - (void)executeOnClientRunLoopAfterDelay:(NSTimeInterval)delayInSeconds block:(d @implementation OHHTTPStubsProtocol -+ (BOOL)canInitWithTask:(NSURLSessionTask *)task { - return [super canInitWithTask:task]; -} - - (id)initWithManager:(id)manager request:(NSURLRequest *)request cachedResponse:(NSCachedURLResponse *)response From 5ded49c3965a1b9ab2d420b8fc50c8ecbace2e0b Mon Sep 17 00:00:00 2001 From: Nickolas Pohilets Date: Mon, 1 May 2017 10:23:46 +0200 Subject: [PATCH 7/8] Applied review comments: Renamed 'defaultInstance' back to 'sharedInstance'. --- OHHTTPStubs/Sources/OHHTTPStubs.h | 2 +- OHHTTPStubs/Sources/OHHTTPStubs.m | 32 +++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/OHHTTPStubs/Sources/OHHTTPStubs.h b/OHHTTPStubs/Sources/OHHTTPStubs.h index cef176ae..5863032a 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubs.h +++ b/OHHTTPStubs/Sources/OHHTTPStubs.h @@ -41,7 +41,7 @@ NS_ASSUME_NONNULL_BEGIN /** * Returns default instance that handles NSURLConnection and default NSURLSessionConfiguration */ -+ (instancetype)defaultInstance; ++ (instancetype)sharedInstance; /** * You can also create a new instance for more flexible configuration management. diff --git a/OHHTTPStubs/Sources/OHHTTPStubs.m b/OHHTTPStubs/Sources/OHHTTPStubs.m index 75f1a768..22403ad5 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubs.m +++ b/OHHTTPStubs/Sources/OHHTTPStubs.m @@ -55,16 +55,16 @@ @implementation OHHTTPStubs //////////////////////////////////////////////////////////////////////////////// #pragma mark - Singleton methods -+ (instancetype)defaultInstance ++ (instancetype)sharedInstance { - static OHHTTPStubs *defaultInstance = nil; + static OHHTTPStubs *sharedInstance = nil; static dispatch_once_t predicate; dispatch_once(&predicate, ^{ - defaultInstance = [[self alloc] init]; - [defaultInstance setEnabled:YES]; + sharedInstance = [[self alloc] init]; + [sharedInstance setEnabled:YES]; }); - return defaultInstance; + return sharedInstance; } //////////////////////////////////////////////////////////////////////////////// @@ -98,40 +98,40 @@ - (void)dealloc +(id)stubRequestsPassingTest:(OHHTTPStubsTestBlock)testBlock withStubResponse:(OHHTTPStubsResponseBlock)responseBlock { - return [OHHTTPStubs.defaultInstance stubRequestsPassingTest:testBlock withStubResponse:responseBlock]; + return [OHHTTPStubs.sharedInstance stubRequestsPassingTest:testBlock withStubResponse:responseBlock]; } +(BOOL)removeStub:(id)stubDesc { - return [OHHTTPStubs.defaultInstance removeStub:stubDesc]; + return [OHHTTPStubs.sharedInstance removeStub:stubDesc]; } +(void)removeAllStubs { - [OHHTTPStubs.defaultInstance removeAllStubs]; + [OHHTTPStubs.sharedInstance removeAllStubs]; } #pragma mark > Disabling & Re-Enabling stubs +(void)setEnabled:(BOOL)enabled { - [OHHTTPStubs.defaultInstance setEnabled:enabled]; + [OHHTTPStubs.sharedInstance setEnabled:enabled]; } +(BOOL)isEnabled { - return OHHTTPStubs.defaultInstance.isEnabled; + return OHHTTPStubs.sharedInstance.isEnabled; } #if defined(__IPHONE_7_0) || defined(__MAC_10_9) + (void)setEnabled:(BOOL)enable forSessionConfiguration:(NSURLSessionConfiguration*)sessionConfig { - [OHHTTPStubs.defaultInstance setEnabled:enable forSessionConfiguration:sessionConfig]; + [OHHTTPStubs.sharedInstance setEnabled:enable forSessionConfiguration:sessionConfig]; } + (BOOL)isEnabledForSessionConfiguration:(NSURLSessionConfiguration *)sessionConfig { - return [OHHTTPStubs.defaultInstance isEnabledForSessionConfiguration:sessionConfig]; + return [OHHTTPStubs.sharedInstance isEnabledForSessionConfiguration:sessionConfig]; } #endif @@ -139,22 +139,22 @@ + (BOOL)isEnabledForSessionConfiguration:(NSURLSessionConfiguration *)sessionCon +(NSArray*)allStubs { - return [OHHTTPStubs.defaultInstance allStubs]; + return [OHHTTPStubs.sharedInstance allStubs]; } +(void)onStubActivation:(nullable OHHTTPStubsActivationBlock)block { - [OHHTTPStubs.defaultInstance onStubActivation:block]; + [OHHTTPStubs.sharedInstance onStubActivation:block]; } +(void)onStubRedirectResponse:(nullable OHHTTPStubsRedirectBlock)block { - [OHHTTPStubs.defaultInstance onStubRedirectResponse:block]; + [OHHTTPStubs.sharedInstance onStubRedirectResponse:block]; } +(void)afterStubFinish:(nullable OHHTTPStubsFinishBlock)block { - [OHHTTPStubs.defaultInstance afterStubFinish:block]; + [OHHTTPStubs.sharedInstance afterStubFinish:block]; } From 0519d6ae363dbbb6b4f890c2d75b6ccee4de983d Mon Sep 17 00:00:00 2001 From: Nickolas Pohilets Date: Wed, 3 May 2017 14:31:25 +0200 Subject: [PATCH 8/8] Updated copyright headers --- OHHTTPStubs/Sources/OHHTTPStubsDescriptor.h | 30 ++++++++++++++++----- OHHTTPStubs/Sources/OHHTTPStubsDescriptor.m | 30 ++++++++++++++++----- OHHTTPStubs/Sources/OHHTTPStubsProtocol.h | 30 ++++++++++++++++----- OHHTTPStubs/Sources/OHHTTPStubsProtocol.m | 30 ++++++++++++++++----- OHHTTPStubs/Sources/OHHTTPStubsTypes.h | 30 ++++++++++++++++----- 5 files changed, 115 insertions(+), 35 deletions(-) diff --git a/OHHTTPStubs/Sources/OHHTTPStubsDescriptor.h b/OHHTTPStubs/Sources/OHHTTPStubsDescriptor.h index 92391ba7..33fed3bd 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubsDescriptor.h +++ b/OHHTTPStubs/Sources/OHHTTPStubsDescriptor.h @@ -1,10 +1,26 @@ -// -// OHHTTPStubsDescriptor.h -// OHHTTPStubs -// -// Created by Nickolas Pohilets on 29.04.17. -// Copyright © 2017 AliSoftware. All rights reserved. -// +/*********************************************************************************** + * + * Copyright (c) 2012 Olivier Halligon + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + ***********************************************************************************/ #import #import "OHHTTPStubsTypes.h" diff --git a/OHHTTPStubs/Sources/OHHTTPStubsDescriptor.m b/OHHTTPStubs/Sources/OHHTTPStubsDescriptor.m index 6f39502c..75c200ab 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubsDescriptor.m +++ b/OHHTTPStubs/Sources/OHHTTPStubsDescriptor.m @@ -1,10 +1,26 @@ -// -// OHHTTPStubsDescriptor.m -// OHHTTPStubs -// -// Created by Nickolas Pohilets on 29.04.17. -// Copyright © 2017 AliSoftware. All rights reserved. -// +/*********************************************************************************** + * + * Copyright (c) 2012 Olivier Halligon + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + ***********************************************************************************/ #import "OHHTTPStubsDescriptor.h" diff --git a/OHHTTPStubs/Sources/OHHTTPStubsProtocol.h b/OHHTTPStubs/Sources/OHHTTPStubsProtocol.h index 460c9b58..05dee805 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubsProtocol.h +++ b/OHHTTPStubs/Sources/OHHTTPStubsProtocol.h @@ -1,10 +1,26 @@ -// -// OHHTTPStubsProtocol.h -// OHHTTPStubs -// -// Created by Nickolas Pohilets on 29.04.17. -// Copyright © 2017 AliSoftware. All rights reserved. -// +/*********************************************************************************** + * + * Copyright (c) 2012 Olivier Halligon + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + ***********************************************************************************/ #import #import "OHHTTPStubsDescriptor.h" diff --git a/OHHTTPStubs/Sources/OHHTTPStubsProtocol.m b/OHHTTPStubs/Sources/OHHTTPStubsProtocol.m index 894252f6..1f291a78 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubsProtocol.m +++ b/OHHTTPStubs/Sources/OHHTTPStubsProtocol.m @@ -1,10 +1,26 @@ -// -// OHHTTPStubsProtocol.m -// OHHTTPStubs -// -// Created by Nickolas Pohilets on 29.04.17. -// Copyright © 2017 AliSoftware. All rights reserved. -// +/*********************************************************************************** + * + * Copyright (c) 2012 Olivier Halligon + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + ***********************************************************************************/ #import "OHHTTPStubsProtocol.h" #import diff --git a/OHHTTPStubs/Sources/OHHTTPStubsTypes.h b/OHHTTPStubs/Sources/OHHTTPStubsTypes.h index f4e25c7f..7faa6dcc 100644 --- a/OHHTTPStubs/Sources/OHHTTPStubsTypes.h +++ b/OHHTTPStubs/Sources/OHHTTPStubsTypes.h @@ -1,10 +1,26 @@ -// -// OHHTTPStubsTypes.h -// OHHTTPStubs -// -// Created by Nickolas Pohilets on 29.04.17. -// Copyright © 2017 AliSoftware. All rights reserved. -// +/*********************************************************************************** + * + * Copyright (c) 2012 Olivier Halligon + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + ***********************************************************************************/ #import #import "OHHTTPStubsResponse.h"