HDHttpRequestManager.h 1.5 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
//
//  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];
 
 */

Hanruisong's avatar
Hanruisong committed
28
29
30
31
32
33
34
35
36
37
/*!
 * @method
 * @abstract GET请求
 * @discussion get请求
 * @param URLString url
 * @param headers 请求头headers
 * @param success 请求成功回调
 * @param failure 请求失败回调
 * @result DWHTTPRequest对象
 */
Han Ruisong's avatar
Han Ruisong committed
38
39
40
41
42
+(DWHTTPRequest *)GET:(NSString *)URLString
              Headers:(NSDictionary <NSString *, NSString *> *)headers
              Success:(HDSSuccessBlock)success
              Failure:(HDSFailureBlock)failure;

Hanruisong's avatar
Hanruisong committed
43
44
45
46
47
48
49
50
51
/*!
 * @method
 * @abstract POST请求
 * @discussion POST请求
 * @param headers 请求头headers
 * @param success 请求成功回调
 * @param failure 请求失败回调
 * @result DWHTTPRequest对象
 */
Han Ruisong's avatar
Han Ruisong committed
52
53
54
55
56
57
+(DWHTTPRequest *)POST:(NSString *)URLString
               Headers:(NSDictionary <NSString *, NSString *> *)headers
               Success:(HDSSuccessBlock)success
               Failure:(HDSFailureBlock)failure;

@end