Skip to content

Commit

Permalink
Assertion to check that the auth server returns an NSDictionary/hash
Browse files Browse the repository at this point in the history
and fail fast if it does not. Closes #40.
  • Loading branch information
lukeredpath committed Apr 26, 2012
1 parent 3119f7c commit 96baadf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Library/PTPusherChannelAuthorizationOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ - (void)finish
{
authorized = ([(NSHTTPURLResponse *)URLResponse statusCode] == 200 || [(NSHTTPURLResponse *)URLResponse statusCode] == 201);
authorizationData = [[PTJSON JSONParser] objectFromJSONData:responseData];

NSAssert2([authorizationData isKindOfClass:[NSDictionary class]],
@"Expected server to return authorization response as a dictionary, but received %@: %@",
NSStringFromClass([authorizationData class]), authorizationData);

if (self.completionHandler) {
self.completionHandler(self);
Expand Down

0 comments on commit 96baadf

Please sign in to comment.