How to send multiple requests without nesting?
See original GitHub issueI would like to send multiple requests sequentially in the beore() method of my test. How do I do this without deeply nesting the code. This is what I have right now:
describe('Conf Test', function() {
this.timeout(5000);
before(function(done) {
sequelize.sync({
force: true
}).then(
function() {
request(app)
.post('/albums')
.send({name: 'Beatles'})
.set('Accept', 'application/json')
.end(function() {
request(app)
.post('/albums')
.send({name: 'Deep Purple'})
.set('Accept', 'application/json')
.end(function() {
done();
});
});
}
);
});
Issue Analytics
- State:
- Created 10 years ago
- Reactions:4
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to send multiple requests without nesting? #108 - GitHub
I would like to send multiple requests sequentially in the beore() method of my test. How do I do this without deeply nesting...
Read more >Making multiple web api calls synchronously without nesting ...
Suppose you have a function called retrieveProducts , you need to make that function async and then await for the response to keep...
Read more >How to send multiple requests using axios - Storyblok
Let us start with a small task and sending one request using Axios itself. First, we import axios and define the API/URL we...
Read more >Using axios.all to make concurrent requests - LogRocket Blog
In this post, we'll learn how to use the axios.all function to make HTTP requests, the difference between using Promise.all and axios ...
Read more >Handling Nested HTTP Requests Using the Fetch API
First, you will take a look at the naive approach to modeling chained HTTP requests, which is using nested calls to fetch ....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @visionmedia, I was able to use async to remove the deep nesting. My code is definitely more readable now. What do you think of using such utitlities with supertest?
what do you think of supertest-as-promised?
https://github.com/WhoopInc/supertest-as-promised
Is it any good?