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?

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.