Skip to content

Conversation

@jayztemplier
Copy link

I followed those instruction to be able to add some metadata in a put request:
http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html

Example:

    [client putObjectWithData:imageData key:key mimeType:@"image/jpg" metadata:@{@"body" : @"custom body"} progress:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {

    } success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSLog(@"Upload Successful! %@", [operation responseString]);
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"Upload Failed... %@", error);
    }];

@jayztemplier
Copy link
Author

#3

MCAWSS3Client.m Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't setDefaultHeader: set that data for this and all following requests? It's fine to use it for values that will be overwritten every time like x-amz-security-token but I'm not sure it's the right thing to do for user defined metadata.

I would suggest adding them to the NSMutableURLRequest. What do you think?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it needs more refactoring first then since we need to include those header params when we construct the string to sign. Working on it.

@jayztemplier
Copy link
Author

It's a little bit more code but it works and set the metadata in the request headers instead of the default headers. Thanks for the feedback :)

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

Successfully merging this pull request may close these issues.

2 participants