Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send an http delete request

I need to how I can send an http delete request, I've implemented the code below

- (void) deleteSyncRequestWithURL:(NSString *) url
{
    NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];

    [request setURL:[NSURL URLWithString:url]];
    [request setHTTPMethod:@"DELETE"];  
    _connection = [[NSURLConnection connectionWithRequest:request delegate:self] retain];    
}

But I've got a 404 status.

Does anyone know what I'm missing??

P.S: I'm using xcode 3.2.3, simulator 4.0

like image 481
UnSaid Avatar asked Nov 14 '22 13:11

UnSaid


1 Answers

It looks as if your Delete request is being issued correctly, but the server is choosing to respond with a 404 - document not found error.

Do you have control over the server application too? Are you sure the server has a resource at that URL that responds to a Delete request?

If you are suspicious of the Delete request being made - I would use an HTTP proxy to examine the request directly, you can then compare to your other client. I would use Wireshark (on the Mac). If the other client is on a PC, you could use Fiddler, which is excellent.

like image 136
iandotkelly Avatar answered Nov 16 '22 03:11

iandotkelly