Skip to content

Instantly share code, notes, and snippets.

@r3econ
Created July 3, 2015 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r3econ/e044c00f026c3f47610a to your computer and use it in GitHub Desktop.
Save r3econ/e044c00f026c3f47610a to your computer and use it in GitHub Desktop.
NSHTTPCookieStorage (RAFExtensions)
@implementation NSHTTPCookieStorage (RAFExtensions)
- (void)logCookies;
{
NSMutableString *descriptions = [NSMutableString string];
for (NSHTTPCookie *cookie in [self cookies])
{
[descriptions appendString:[self cookieDescription:cookie]];
}
NSLog(@"-------- [Cookie Dump] -----------\n%@", descriptions);
NSLog(@"----------------------------------");
}
- (NSString *)cookieDescription:(NSHTTPCookie *)cookie
{
NSMutableString *description = [NSMutableString string];
[description appendString:@"[NSHTTPCookie]\n"];
[description appendFormat:@" name = %@\n", [cookie name]];
[description appendFormat:@" value = %@\n", [cookie value]];
[description appendFormat:@" domain = %@\n", [cookie domain]];
[description appendFormat:@" path = %@\n", [cookie path]];
[description appendFormat:@" expiresDate = %@\n", [cookie expiresDate]];
[description appendFormat:@" sessionOnly = %d\n", [cookie isSessionOnly]];
[description appendFormat:@" secure = %d\n", [cookie isSecure]];
[description appendFormat:@" comment = %@\n", [cookie comment]];
[description appendFormat:@" commentURL = %@\n", [cookie commentURL]];
[description appendFormat:@" version = %lu\n", (unsigned long)[cookie version]];
return description;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment