Webサービスがあります。小さい(サムネイルサイズ)画像のbase64文字列表現を受け入れるために使用します。このWebサービスは、Fiddlerで使用し、手動でリクエストを投稿すると、非常にうまく機能します。NSMutableURLRequest(またはASIHTTPRequest)を使用して同じリクエストを実行すると、常に413ステータスコードが返されます(413はリクエストエンティティが大きすぎます)。
NSMutableURLRequestによって413が発生するのに対し、Fiddlerは毎回200を返すのはなぜですか?
これが私のNSMutableURLRequestコードです。誰かが何かアイデアを持っているなら、私は本当にプッシュを使うことができます。
//the image request
NSMutableURLRequest *imageRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:POST_IMAGE_API_URL]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:240.0];
//the post parameters
[imageRequest setHTTPMethod:@"POST"];
[imageRequest setHTTPBody:[imageMessage dataUsingEncoding:NSUTF8StringEncoding]];
[imageRequest setValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
//a few other things
NSURLResponse* imageresponse;
NSError *imageerror;
NSData* imageresult = [NSURLConnection sendSynchronousRequest:imageRequest returningResponse:&imageresponse error:&imageerror];
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)imageresponse;
NSLog(@"imageresponse: %d", httpResponse.statusCode);