Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASIHttpRequest DELETE method with body parameters

I use ASIHttpRequest (v. 1.8-95) for Iphone and wanted to create a synchronous DELETE request together with some body data. I went this way:

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:nsUrl];
[request appendPostData:[@"some body params" dataUsingEncoding:NSUTF8StringEncoding]];
[request setRequestMethod:@"DELETE"];
[request startSynchronous];

Although I was confirmed on the client side via

NSLog(@"request: method:%@", request.requestMethod);

that the method was correctly set to "DELETE" on the server side a "POST" request was received !

If I just omit

[request appendPostData: ..]

a correct DELETE is received on the server side)

So what's wrong with my request ? Thanks for any solutions.

Regards

creator_11

like image 426
creator_11 Avatar asked Jun 27 '11 23:06

creator_11


1 Answers

Searching the asihttprequest group ( http://groups.google.com/group/asihttprequest/search?group=asihttprequest&q=delete&qt_g=Search+this+group ) turns up some relevant posts including a suggested workaround:

call buildPostBody on your request after you've populated the body, but before you set the request method.

like image 133
JosephH Avatar answered Oct 01 '22 13:10

JosephH