Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addDataFuncHandler should accept asynchronous function bodies #141

Open
tnypxl opened this issue Apr 12, 2022 · 2 comments
Open

addDataFuncHandler should accept asynchronous function bodies #141

tnypxl opened this issue Apr 12, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@tnypxl
Copy link

tnypxl commented Apr 12, 2022

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)
@ASaiAnudeep ASaiAnudeep added the enhancement New feature or request label Apr 13, 2022
@ASaiAnudeep
Copy link
Member

ASaiAnudeep commented Apr 13, 2022

@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.

@tzmgit
Copy link

tzmgit commented Jan 31, 2023

Any workaround for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants