Closed
Description
Hello.
Since the switch from requests
to native-request
UrlFileManager does not handle redericts anymore. This leads to an error here (and possibly in other similar code) if response body is empty (like often happens with 301 responses). The error is
Warning: Empty body (HTTP 301) returned by "https://url.that/redirects/here"
.../node_modules/less/lib/less/import-manager.js:97
var contents = loadedFile.contents.replace(/^\uFEFF/, '');
^
TypeError: Cannot read property 'replace' of null
at loadFileCallback (.../node_modules/less/lib/less/import-manager.js:97:52)
Which might be fine when you use less from CLI. But the real issue happens when you try to call less.parse
directly in your code. Somehow instead of passing the error to a callback, or rejecting a promise less.parse
causes unhandledRejection
.