Thursday 21 December 2017

Failing to Test URL for Validity When Cert is LetsEncrypt

I am having a problem with the following code to test for a valid URL in v6.10:exports.validURL = function(url, validURLCallback) { try { var https = require('https'); var req = https.get(url, (httpResp) => { validURLCallback(httpResp && httpResp.statusCode && (httpResp.statusCode.toString().startsWith("2") || httpResp.statusCode.toString().startsWith("3"))); }); req.on('error', (err) => { validURLCallback(false) }); req.end(); } catch (err) { validURLCallback(false); } } Basically it's getting an HTTP 403 (forbidden) error

Submitted December 21, 2017 at 10:30PM by stankbucket

No comments:

Post a Comment