public callHttp()

in src/orchestrations/DurableOrchestrationContext.ts [222:261]


    public callHttp(options: CallHttpOptions): Task {
        let content = options.body;
        if (content && typeof content !== "string") {
            content = JSON.stringify(content);
        }

        let enablePolling = true;
        if (options.enablePolling !== undefined) {
            enablePolling = options.enablePolling;
        } else if (options.asynchronousPatternEnabled !== undefined) {
            enablePolling = options.asynchronousPatternEnabled;
        }
        const request = new DurableHttpRequest(
            options.method,
            options.url,
            content as string,
            options.headers,
            options.tokenSource,
            enablePolling
        );
        const newAction = new CallHttpAction(request);
        if (this.schemaVersion >= ReplaySchema.V3 && request.asynchronousPatternEnabled) {
            if (!this.defaultHttpAsyncRequestSleepTimeMillseconds) {
                throw Error(
                    "A framework-internal error was detected: replay schema version >= V3 is being used, " +
                        "but `defaultHttpAsyncRequestSleepDuration` property is not defined. " +
                        "This is likely an issue with the Durable Functions Extension. " +
                        "Please report this bug here: https://github.com/Azure/azure-functions-durable-js/issues"
                );
            }
            return new CallHttpWithPollingTask(
                false,
                newAction,
                this,
                this.taskOrchestratorExecutor,
                this.defaultHttpAsyncRequestSleepTimeMillseconds
            );
        }
        return new AtomicTask(false, newAction);
    }