Double callback and error on basic GET request
See original GitHub issueSummary: When calling a GET request, I get a strange minimal error and a “double callback!” warning. Setting the exact same headers works just fine with no errors using curl or HTTPie.
Version: 1.2.0
Error:
{ [SyntaxError: Unexpected token I] response: undefined }
double callback!
Code:
request
.get(url)
.set('Accept', 'application/json')
.set('X-ApiTokenId', 'abc-123')
.set('X-SessionId', 'def-456')
.end((err, res) => {
if (err) {
cb(err, res);
}
else {
cb(null, []);
}
});
Issue Analytics
- State:
- Created 8 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Double callback and error on basic GET request #633 - GitHub
It calls the callback and processing continues, which means that later an end listener is registered and that calls the callback again.
Read more >Fire callback after two separate successful http requests
A simple still parallel solution would be something like: let serviceStatus = { aDone: false, bDone: false }; let getDataA = (callback: ...
Read more >Preventing callbacks from accidentally being called twice
Another option is to keep track of whether the callback has already been called and throw an error if there's an attempt to...
Read more >Error-First Callback in Node.js - GeeksforGeeks
Error -First Callback in Node.js is a function which either returns an error object or any successful data returned by the function.
Read more >AWS Lambda function handler in Node.js
The callback function takes two arguments: an Error and a response. When you call it, Lambda waits for the event loop to be...
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
Ignore. Looking at the wrong terminal.