HTTP request callback function inside reporter not called
See original GitHub issue- Newman Version (can be found via
newman -v
): 4.5.5 - OS details (type, version, and architecture): macOS
- Are you using Newman as a library, or via the CLI? CLI
I am trying to use the node request library from within a Newman reporter. Below is a sample code:
newman.on('beforeDone', () => {
console.log('before');
var request = require('request');
request('http://httpbin.org/get', function (error, response, body) {
console.log('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
console.log('body:', body); // Print the HTML for the Google homepage.
});
console.log('after');
});
Maybe I am missing something, but the console.log statements inside the callback function are not called. Only before
and after
is printed.
Do you have any idea why?
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
HTTP request callback not being fired - Forums
In my handlers, I have an intent (SelectGardenIntent) that obtains the user_id (needed for following HTTP requests) from the access token successfully, ...
Read more >Node.JS Request Module Callback Not Firing - Stack Overflow
I have tried running the above code just using standard Node.JS libraries, to no avail. The callback function is never fired and the...
Read more >Callbacks / Callables - Manual - PHP
Callbacks registered with functions such as call_user_func() and call_user_func_array() will not be called if there is an uncaught exception thrown in a ...
Read more >5.x API - Express.js
toString() may fail in multiple ways, for example foo may not be there or may not ... If a function, the type option...
Read more >Write HTTP functions - Documentation - Google Cloud
In Cloud Functions, you use HTTP functions when you want to invoke a function via an HTTP(S) request. To allow for HTTP semantics,...
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 Free
Top 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
@codenirvana I have managed to recreate this problem in a more stable environment:
https://gitlab.com/user-questions/newman-issues-2148
I have two parallel jobs, using the same code, one running a collection with tests that pass and the other one running a collection with tests that fail.
Passing output: https://gitlab.com/user-questions/newman-issues-2148/-/jobs/323512933 Failing output: https://gitlab.com/user-questions/newman-issues-2148/-/jobs/323512932
Only when the collection test pass, will the callback be executed.
@codenirvana Is there any update on this issue? I’m also faced issue described in https://github.com/postmanlabs/newman/issues/2148#issuecomment-543075798
I’m writing new reporter for quite new TMS and this looks like a very unexpected behaviour. I also have lots of async request, which are correctly served when all tests are passed and not - when something is failed.