azure-storage-common/src/Common/Middlewares/RetryMiddleware.php
protected function onFulfilled(RequestInterface $request, array $options)
    {
        return function (ResponseInterface $response) use ($request, $options) {
            $isSecondary = Utilities::requestSentToSecondary($request, $options);
            if (!isset($options['retries'])) {
                $options['retries'] = 0;
            }
            if (call_user_func(
                $this->decider,
                $options['retries'],
                $request,
                $response,
                null,
                $isSecondary
            )) {
                return $this->retry($request, $options, $response);
            }
            //Add the header that indicates the endpoint to be used if
            //continuation token is used for subsequent request.
            if ($isSecondary) {
                $response = $response->withHeader(
                    Resources::X_MS_CONTINUATION_LOCATION_MODE,
                    LocationMode::SECONDARY_ONLY
                );
            } else {
                $response = $response->withHeader(
                    Resources::X_MS_CONTINUATION_LOCATION_MODE,
                    LocationMode::PRIMARY_ONLY
                );
            }
            return $response;
        };
    }
protected function onFulfilled(RequestInterface $request, array $options)
    {
        return function (ResponseInterface $response) use ($request, $options) {
            $isSecondary = Utilities::requestSentToSecondary($request, $options);
            if (!isset($options['retries'])) {
                $options['retries'] = 0;
            }
            if (call_user_func(
                $this->decider,
                $options['retries'],
                $request,
                $response,
                null,
                $isSecondary
            )) {
                return $this->retry($request, $options, $response);
            }
            //Add the header that indicates the endpoint to be used if
            //continuation token is used for subsequent request.
            if ($isSecondary) {
                $response = $response->withHeader(
                    Resources::X_MS_CONTINUATION_LOCATION_MODE,
                    LocationMode::SECONDARY_ONLY
                );
            } else {
                $response = $response->withHeader(
                    Resources::X_MS_CONTINUATION_LOCATION_MODE,
                    LocationMode::PRIMARY_ONLY
                );
            }
            return $response;
        };
    }
This function will be invoked after the request is sent, if
the promise is fulfilled.

@param  RequestInterface $request the request sent.
@param  array            $options the options that the request sent with.

@return callable