1
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);
        });
}

The error I'm getting is [tslint] Forbidden http url in string 'http://localhost:3000/stuff' (no-http-string)

I could get this error ignored by putting // tslint:disable-next-line above the fetch() method, but is there any other solution to this?

Attila
  • 1,097
  • 2
  • 19
  • 45

1 Answers1

2

Description of this rule is Do not use strings that start with 'http:'. URL strings should start with 'https:'.

1) Put // tslint:disable-next-line:no-http-string above the fetch() method to disable inspection for one line

2) Put

{
    "rules": {
        "no-http-string": false, // <---- this line
    }
}

in tslint.json to disable inspection for all project