【发布时间】:2018-01-30 20:57:57
【问题描述】:
function getStuff(req: express.Request, res: express.Response, next: express.NextFunction): void {
fetch('http://localhost:3000/stuff')
.then((data: {}) => {
res.send(data.body._readableState.buffer.head.data.toString());
})
.catch((err: {}) => {
res.json(err);
});
}
我得到的错误是[tslint] Forbidden http url in string 'http://localhost:3000/stuff' (no-http-string)
我可以通过将// tslint:disable-next-line 放在fetch() 方法上方来忽略此错误,但是还有其他解决方案吗?
【问题讨论】:
标签: typescript tslint node-fetch