Attila Attila - 6 months ago 62
TypeScript Question

tslint: Forbidden http url in string

function getStuff(req: express.Request, res: express.Response, next: express.NextFunction): void {
.then((data: {}) => {
.catch((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
method, but is there any other solution to this?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download