Merge pull request #1019 from kylef/init
[AFHTTPClient init] should raise an exception
This commit is contained in:
commit
c9eb2d380c
@ -221,6 +221,12 @@ NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) {
|
||||
return [[self alloc] initWithBaseURL:url];
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
@throw [NSException exceptionWithName:NSInternalInconsistencyException
|
||||
reason:[NSString stringWithFormat:@"%@ Failed to call designated initializer. Invoke `initWithBaseURL:` instead.", NSStringFromClass([self class])]
|
||||
userInfo:nil];
|
||||
}
|
||||
|
||||
- (id)initWithBaseURL:(NSURL *)url {
|
||||
NSParameterAssert(url);
|
||||
|
||||
|
||||
@ -35,6 +35,10 @@
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)testInitRaisesException {
|
||||
expect(^{ (void)[[AFHTTPClient alloc] init]; }).to.raiseAny();
|
||||
}
|
||||
|
||||
- (void)testDefaultHeaders {
|
||||
[self.client setDefaultHeader:@"x-some-key" value:@"SomeValue"];
|
||||
expect([self.client defaultValueForHeader:@"x-some-key"]).to.equal(@"SomeValue");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user