Skip to content

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

@nmiyasato

Description

@nmiyasato

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:@"&"];
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions