Skip to content
Browse files

replaced NSNumber-specific check with cleaner polymorphic call to [va…

…l urlEncodedString]
  • Loading branch information...
1 parent 6b8d4b9 commit eea5c839faec6addca8af4cb89908cee18e22229 @gwk gwk committed Feb 11, 2013
Showing with 21 additions and 4 deletions.
  1. +6 −0 src/FSN_categories.h
  2. +15 −4 src/FSN_categories.m
View
6 src/FSN_categories.h
@@ -213,6 +213,12 @@ BOOL httpCodeIsOfClass(int httpCode, FSNHTTPCodeClass httpClass);
@end
+@interface NSNumber (FSN)
+
+- (NSString*)urlEncodedString; // just returns stringValue
+
+@end
+
@interface NSURLResponse (FSN)
View
19 src/FSN_categories.m
@@ -48,10 +48,7 @@ - (NSString *)urlQueryString {
continue;
}
- [string appendFormat:@"%@%@=%@",
- (first ? @"" : @"&"),
- [key urlEncodedString],
- [([val isKindOfClass:[NSNumber class]] ? [val stringValue] : val) urlEncodedString]];
+ [string appendFormat:@"%@%@=%@", (first ? @"" : @"&"), [key urlEncodedString], [val urlEncodedString]];
first = NO;
}
@@ -198,6 +195,20 @@ - (NSData *)UTF8Data {
@end
+
+
+@implementation NSNumber (FSN)
+
+
+- (NSString *)urlEncodedString {
+ return self.stringValue;
+}
+
+
+@end
+
+
+
@implementation NSURLResponse (FSN)

0 comments on commit eea5c83

Please sign in to comment.
Something went wrong with that request. Please try again.