AFNetworking/AFNetworking — pull request #1777 by eleven-huang (2014-01-26 09:38:12+00:00)
Title: Add finish block for all http request methods in AFHttpRequestOperationM...

I need to execute some operations after a http request at many times, such as stop refreshing from UIRereshControl or hide Progress HUD.

[manager GET:url_string parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
[self.refreshControl endRefreshing];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
[self.refreshControl endRefreshing];
}];

As you can see, i need to writen in two places, it is annoying.

So i add a finish block to all http request methods in AFHttpRequestOperationManager, but keep the original methods.

[manager GET:url_string parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {

} failure:^(AFHTTPRequestOperation *operation, NSError *error) {

} finish:^(AFHTTPRequestOperation *operation) {
[self.refreshControl endRefreshing];
}];

The finish block will be executed after success block or failure block.