Revision 0be02d23 asi-http-request-with-pithos/Classes/Pithos/ASIPithosAccountRequest.m

b/asi-http-request-with-pithos/Classes/Pithos/ASIPithosAccountRequest.m
120 120

  
121 121
- (NSDictionary *)groups {
122 122
    if (groups == nil) {
123
        groups = [self getHeadersDictionaryForPrefix:@"X-Account-Group-"];
123
        groups = [NSMutableDictionary dictionary];
124
        NSMutableDictionary *groupsHeaders = [self getHeadersDictionaryForPrefix:@"X-Account-Group-"];
125
        for (NSString *groupName in groupsHeaders) {
126
            [groups setObject:[[groupsHeaders objectForKey:groupName] componentsSeparatedByString:@","]
127
                       forKey:groupName];
128
        }
124 129
        [groups retain];
125 130
    }
126 131
    return groups;
......
248 253
    ASIPithosAccountRequest *request = [self storageRequestWithMethod:@"POST" pithos:pithos queryString:queryString];
249 254
	
250 255
    if (groups) {
251
        for (NSString *key in [groups keyEnumerator]) {
256
        for (NSString *key in groups) {
252 257
            [request addRequestHeader:[self encodeToPercentEscape:[NSString stringWithFormat:@"X-Account-Group-%@", key]] 
253
                                value:[self encodeToPercentEscape:[groups objectForKey:key]]];
258
                                value:[self encodeToPercentEscape:[[groups objectForKey:key] componentsJoinedByString:@","]]];
254 259
        }
255 260
    }
256 261
    
257 262
    if (metadata) {
258
        for (NSString *key in [metadata keyEnumerator]) {
263
        for (NSString *key in metadata) {
259 264
            [request addRequestHeader:[self encodeToPercentEscape:[NSString stringWithFormat:@"X-Account-Meta-%@", key]] 
260 265
                                value:[self encodeToPercentEscape:[metadata objectForKey:key]]];
261 266
        }

Also available in: Unified diff