コピー(A NSURLConnection wrapper for humans)が面白い。
"It took me 15 minutes to do with STHTTPRequest what I couldn’t do in 3 hours with AFNetworking."だそうです。
@sburlot
クラスは STHTTPRequest たった一個で、これに対して通信メソッドを叩いたり、レスポンスを取得する。
主要なメソッド。
typedef void (^uploadProgressBlock_t)(NSInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite); typedef void (^downloadProgressBlock_t)(NSData *data, NSInteger totalBytesReceived, NSInteger totalBytesExpectedToReceive); typedef void (^completionBlock_t)(NSDictionary *headers, NSString *body); typedef void (^completionDataBlock_t)(NSDictionary *headers, NSData *body); typedef void (^errorBlock_t)(NSError *error);
特徴
Simple...
700 lines of Objective-C you can understand
runs on iOS 5+ and Mac OS X 10.7+
just drag and drop .h and .m in your project
pod 'STHTTPRequest' in CocoaPods
new BSD license
... yet powerful
synchronous and asynchronous (block based) calls
easy to set request headers, cookies and POST data
easy to get response status, headers and encoding
file upload with progress block
fast and simple HTTP authentication
log requests in curl format
なかなか良さそう。