HDHttpRequestManager.h 1.07 KB
Newer Older
Han Ruisong's avatar
Han Ruisong committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
//  HDHttpRequestManager.h
//  HDBaseUtils
//
//  Created by zwl on 2020/5/6.
//  Copyright © 2020 zwl. All rights reserved.
//

#import <Foundation/Foundation.h>
@class DWHTTPRequest;

typedef void(^HDSSuccessBlock)(id responseObject,NSData *responseBody);
typedef void(^HDSFailureBlock)(id responseObject,NSError *error);

@interface HDHttpRequestManager : NSObject

/**
 eg:
 DWHTTPRequest * r = [HDHttpRequestManager GET:@"" Headers:@{} Success:^(id responseObject,                         NSData *responseBody) {
     
                     } Failure:^(id responseObject, NSError *error) {
     
                     }];
 [r startAsynchronous];
 
 */

+(DWHTTPRequest *)GET:(NSString *)URLString
              Headers:(NSDictionary <NSString *, NSString *> *)headers
              Success:(HDSSuccessBlock)success
              Failure:(HDSFailureBlock)failure;

+(DWHTTPRequest *)POST:(NSString *)URLString
               Headers:(NSDictionary <NSString *, NSString *> *)headers
               Success:(HDSSuccessBlock)success
               Failure:(HDSFailureBlock)failure;

@end