in Source/TNLRequestOperation.m [1201:1242]
static void _network_prepStep_hydrateRequest(TNLRequestOperation * __nullable const self, tnl_request_preparation_block_t nextBlock)
{
if (!self) {
return;
}
TNLAssert(nextBlock != nil);
TNLAssert([self _network_isPreparing]);
id<TNLRequestHydrater> hydrater = self.internalDelegate;
id<TNLRequest> originalRequest = self.originalRequest;
SEL callback = @selector(tnl_requestOperation:hydrateRequest:completion:);
tnl_dispatch_barrier_async_autoreleasing(self->_callbackQueue, ^{
if ([hydrater respondsToSelector:callback]) {
NSString *tag = TAG_FROM_METHOD(hydrater, @protocol(TNLRequestHydrater), callback);
[self _updateTag:tag];
[hydrater tnl_requestOperation:self
hydrateRequest:originalRequest
completion:^(id<TNLRequest> hydratedRequest, NSError *error) {
[self _clearTag:tag];
tnl_dispatch_async_autoreleasing(tnl_network_queue(), ^{
if (![self _network_isPreparing]) {
return;
}
if (error) {
[self _network_fail:TNLErrorCreateWithCodeAndUnderlyingError(TNLErrorCodeRequestOperationFailedToHydrateRequest, error)];
} else {
self.hydratedRequest = hydratedRequest ?: originalRequest;
nextBlock();
}
});
}];
} else {
tnl_dispatch_async_autoreleasing(tnl_network_queue(), ^{
self.hydratedRequest = originalRequest;
nextBlock();
});
}
});
}