#78 new
Aubrey Goodman


Reported by Aubrey Goodman | January 17th, 2011 @ 05:18 PM

When sending both file attachment and form data together in the same request with ASIFormDataRequest from an iOS app to a Rails app, I sometimes see HTTP 500 response with "bad content body" in the Rails log. This does not happen consistently.

Here's the code I'm using to create this problem:

ASIFormDataRequest* tReq = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:tPath]];
[tReq setData:tImageData withFileName:tFileName andContentType:@"image/jpeg" forKey:@"document[original]"];
[tReq setPostValue:[NSString stringWithFormat:@"%@",tPortfolioId] forKey:@"document[portfolio_id]"];
[tReq setPostValue:[NSString stringWithFormat:@"%@",tIdeaId] forKey:@"document[idea_id]"];
[tReq setPostValue:[NSString stringWithFormat:@"%d",tUserId] forKey:@"document[owner_id]"];
tReq.uploadProgressDelegate = self;
tReq.delegate = self;
tReq.timeOutSeconds = 10;
[tReq startAsynchronous];

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Easy to use CFNetwork wrapper for HTTP requests, Objective-C, Mac OS X and iPhone