pactum
pactum copied to clipboard
addDataFuncHandler should accept asynchronous function bodies
Is your feature request related to a problem? Please describe. It's annoying that I can't use asynchronous functions in Data Function handlers
Describe the solution you'd like I invision something like:
pactum.handler.addAsyncDataFuncHandler('MyDataFunction', async () => {
const result = await someAsyncFunction(10);
return result;
})
or
Refactor existing method to accept a boolean whose default value is false. But when set to true will pass the function to an async version of the handler instead (I don't love this approach).
pactum.handler.addDataFuncHandler('MyDataFunction', async () => {
const result = await someAsyncFunction(10);
return result;
}, true)
@tnypxl thank you for the suggestion. I don't think we need an independent function to handle asynchronous tasks. We need to enhance the existing function to support both of them without any additional params.
Any workaround for this?