ctimmerm / axios-mock-adapter

Axios adapter that allows to easily mock requests
MIT License
3.42k stars 241 forks source link

Use Promise in mocked data #350

Open fdrobidoux opened 1 year ago

fdrobidoux commented 1 year ago

I made the mistake of doing this, and it cost me a bunch of time :

mockAxiosAdapter.onGet("/groups")
    .replyOnce(200, Promise.resolve(groups));

Could it be possible to resolve Promises in the transformRequest(data) function in handle_request.js?

Thanks!

ali3nnn commented 11 months ago

why you don't await the promises before and add to the mock just the returned data?