Added -description methods

This commit is contained in:
Pierre-Olivier Latour
2014-04-09 13:44:53 -07:00
parent 4008b5b476
commit 97929f7d89
10 changed files with 112 additions and 7 deletions
+12
View File
@@ -307,4 +307,16 @@
return [_writer close:error];
}
- (NSString*)description {
NSMutableString* description = [NSMutableString stringWithFormat:@"%@ %@", _method, _path];
for (NSString* argument in [[_query allKeys] sortedArrayUsingSelector:@selector(compare:)]) {
[description appendFormat:@"\n %@ = %@", argument, [_query objectForKey:argument]];
}
[description appendString:@"\n"];
for (NSString* header in [[_headers allKeys] sortedArrayUsingSelector:@selector(compare:)]) {
[description appendFormat:@"\n%@: %@", header, [_headers objectForKey:header]];
}
return description;
}
@end