Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to send a dictionary of dictionaries via GET. #46

Open
nmiyasato opened this issue Apr 7, 2014 · 0 comments
Open

Unable to send a dictionary of dictionaries via GET. #46

nmiyasato opened this issue Apr 7, 2014 · 0 comments

Comments

@nmiyasato
Copy link

I've seen that when you use a GET request, the parameter cannot be a dictionary of dictionaries. Why is that? The code is this one:

  • (NSString_)parameterStringForDictionary:(NSDictionary_)parameters {
    NSMutableArray *stringParameters = [NSMutableArray arrayWithCapacity:parameters.count];

    [parameters enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
    if([obj isKindOfClass:[NSString class]]) {
    [stringParameters addObject:[NSString stringWithFormat:@"%@=%@", key, [obj encodedURLParameterString]]];
    }
    else if([obj isKindOfClass:[NSNumber class]]) {
    [stringParameters addObject:[NSString stringWithFormat:@"%@=%@", key, obj]];
    }
    else
    [NSException raise:NSInvalidArgumentException format:@"%@ requests only accept NSString, NSNumber and NSData parameters.", self.operationRequest.HTTPMethod];
    }];

    return [stringParameters componentsJoinedByString:@"&"];
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant