问题
According to SuperAgent docs: SuperAgent docs
var res = yield request
.get('http://local')
.auth('tobi', 'learnboost')
However, I'm finding that the var res isn't res, its req. Meaning I have only access to the request object, not the response object with the fetched data that is usually passed to the end() chainable, which is obviously what I need.
Anyone experience with this? Am I missing something?
回答1:
Although your question was answered on GH, figured I'd paste it here as well for others. The following worked great for me!
var res = yield Promise.resolve(request
.get('http://local')
.auth('tobi', 'learnboost'))
来源:https://stackoverflow.com/questions/35921605/using-yield-with-superagent-returns-request-object-instead-of-response