Parallel API call support #303
Replies: 1 comment
-
While Pactum itself doesn't directly support parallel API calls, there are workarounds you can use to achieve your goal of deleting 100 entities concurrently: const entities = [1, 2, 3, ..., 100]; // Your list of entity IDs
const promises = entities.map(entityId => {
return pactum.spec()
.delete(`http://your-api.com/entities/${entityId}`)
.expectStatus(204); // Expect successful deletion
});
Promise.all(promises)
.then(() => console.log("All entities deleted successfully!"))
.catch(error => console.error("Error deleting entities:", error)); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I'm pretty new to Pactum and JS world. How can we use Pactum for parallel API calls. Let's say I have an endpoint, DELETE which takes a query parameter of an entity to delete. There are 100 entities that I need to delete through this endpoint.
Beta Was this translation helpful? Give feedback.
All reactions