Permalink
Browse files

Update DIOSView.m

if there is only one argument, the & isn't inserted
only from the 2nd argument onwards
  • Loading branch information...
1 parent 63f2f8a commit 6863bddd7f557e27acae357f2e9c5e54a0d59300 @rollingnet rollingnet committed Oct 27, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 DIOSView.m
View
@@ -40,11 +40,20 @@ + (void)viewGet:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
+ int x=0;
+
NSMutableString *path = [NSMutableString stringWithFormat:@"%@/%@/%@?", kDiosEndpoint, kDiosBaseView, [params objectForKey:@"view_name"]];
for (NSString *key in params) {
id value = [params objectForKey:key];
if (![key isEqualToString:@"view_name"]) {
- [path appendFormat:@"%@=%@&", key, value];
+
+ //the code below was inserted because if there is only one argument, the "&" is not needed and the view doesn't work
+ if(x++) {
+ [path appendFormat:@"&"];
+ }
+ // end
+
+ [path appendFormat:@"%@=%@", key, value];
}
}

0 comments on commit 6863bdd

Please sign in to comment.