Azure / azure-functions-durable-js

JavaScript library for using the Durable Functions bindings
https://www.npmjs.com/package/durable-functions
MIT License
128 stars 47 forks source link

Switch `context.df.callHttp` from using discrete optional arguments to using an options object #456

Closed hossam-nasr closed 1 year ago

hossam-nasr commented 1 year ago

This issue has already been implemented (see #435) . This is purely for tracking and documentation purposes.

We should switch the context.df.callHttp() on orchestration contexts from using explicit arguments to using one options argument for all parameters, following the lead of popular frameworks like axios

Before (actual sample from our docs here):

const restartResponse = yield context.df.callHttp(
        "POST",
        `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.Compute/virtualMachines/${vmName}/restart?api-version=${apiVersion}`,
        undefined, // no request content
        undefined, // no request headers (besides auth which is handled by the token source)
        tokenSource
);

After:

const restartResponse = yield context.df.callHttp({
        method: "POST",
        url: `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.Compute/virtualMachines/${vmName}/restart?api-version=${apiVersion}`,
        tokenSource,
});
hossam-nasr commented 1 year ago

Closed by #435