mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-11 11:39:05 +08:00
Added new pre-flight delegate callbacks for customization of RKRequest and RKObjectLoader instances before dispatch
This commit is contained in:
@@ -80,6 +80,16 @@ typedef void(^RKObjectLoaderDidLoadObjectsDictionaryBlock)(NSDictionary *diction
|
||||
*/
|
||||
- (void)objectLoaderDidFinishLoading:(RKObjectLoader *)objectLoader;
|
||||
|
||||
/**
|
||||
Informs the delegate that the object loader has serialized the source object into a serializable representation
|
||||
for sending to the remote system. The serialization can be modified to allow customization of the request payload independent of mapping.
|
||||
|
||||
@param objectLoader The object loader performing the serialization.
|
||||
@param sourceObject The object that was serialized.
|
||||
@param serialization The serialization of sourceObject to be sent to the remote backend for processing.
|
||||
*/
|
||||
- (void)objectLoader:(RKObjectLoader *)objectLoader didSerializeSourceObject:(id)sourceObject toSerialization:(inout id<RKRequestSerializable> *)serialization;
|
||||
|
||||
/**
|
||||
Sent when an object loader encounters a response status code or MIME Type that RestKit does not know how to handle.
|
||||
|
||||
|
||||
@@ -351,6 +351,10 @@
|
||||
[self didFailLoadWithError:error];
|
||||
return NO;
|
||||
}
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(objectLoader:didSerializeSourceObject:toSerialization:)]) {
|
||||
[self.delegate objectLoader:self didSerializeSourceObject:self.sourceObject toSerialization:¶ms];
|
||||
}
|
||||
|
||||
self.params = params;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id<RKRequestSerializable>)serializationForMIMEType:(NSString*)MIMEType error:(NSError**)error {
|
||||
- (id<RKRequestSerializable>)serializationForMIMEType:(NSString *)MIMEType error:(NSError **)error {
|
||||
if ([MIMEType isEqualToString:RKMIMETypeFormURLEncoded]) {
|
||||
// Dictionaries are natively RKRequestSerializable as Form Encoded
|
||||
return [self serializedObject:error];
|
||||
|
||||
Reference in New Issue
Block a user