static void _network_prepStep_convertHydratedRequestToScratchURLRequest()

in Source/TNLRequestOperation.m [1268:1292]


static void _network_prepStep_convertHydratedRequestToScratchURLRequest(TNLRequestOperation * __nullable const self, tnl_request_preparation_block_t nextBlock)
{
    if (!self) {
        return;
    }

    TNLAssert(nextBlock != nil);
    TNLAssert([self _network_isPreparing]);

    NSError *error = nil;
    id<TNLRequest> request = self.hydratedRequest;
    NSMutableURLRequest *mURLRequest = TNLRequestToNSMutableURLRequest(request,
                                                                       self.requestConfiguration,
                                                                       &error);
    if (!mURLRequest) {
        [self _network_fail:error];
        return;
    }

    self->_scratchURLRequest = mURLRequest;
    self->_scratchURLRequestEncodeLatency = 0;
    self->_scratchURLRequestOriginalBodyLength = 0;
    self->_scratchURLRequestEncodedBodyLength = 0;
    nextBlock();
}