forked from icanzilb/HTTPKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDCHTTPResponseSerializer.h
More file actions
45 lines (35 loc) · 1.38 KB
/
DCHTTPResponseSerializer.h
File metadata and controls
45 lines (35 loc) · 1.38 KB
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
39
40
41
42
43
44
45
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// DCHTTPResponseSerializer.h
//
// Created by Dalton Cherry on 5/8/14.
//
////////////////////////////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
@protocol DCHTTPResponseSerializerDelegate <NSObject>
/**
This is used to serialize the request response into any format desired.
This method is called when a request is going to be sent.
@param: response is the NSURLResponse for the request.
@param: data is the payload from the request.
@param: error should be set to a value if an error occurs while parsing and serializing the response.
@return: This is the new object that the data has been formed into.
*/
-(id)responseObjectFromResponse:(NSURLResponse*)response
data:(NSData*)data
error:(NSError *__autoreleasing *)error;
@end
/**
This is a base class for simplicity sake
*/
@interface DCHTTPResponseSerializer : NSObject<DCHTTPResponseSerializerDelegate,NSCopying>
/**
The string encoding used to serialize and decode the payload with.
*/
@property (nonatomic, assign) NSStringEncoding stringEncoding;
@end
/**
This is a JSON parser because most HTTP APIs use JSON and Apple has a builtin parser
*/
@interface DCJSONResponseSerializer : DCHTTPResponseSerializer
@end