Can't override cc.assetManager.downloader.register('.json')

As described here: Download and Parse · Cocos Creator we can override the built-in download method for any asset.

So what i do:

cc.assetManager.downloader.register('.json', (url, options, onComplete) => {
	const oReq = new XMLHttpRequest();
	oReq.open('GET', url, true);

	oReq.onload = (oEvent) => {
		onComplete?.(null, JSON.parse(oReq.response));
	};

	oReq.send(null);
});

Thats it, nothing else. And this code not working on native platforms. I am getting errors like this:
Simulator[] nil host used in call to allowsSpecificHTTPSCertificateForHost

After that i just opened cocos-engine/download-file.js at 793ed1e41a1e981ef927cb5ecccb6f051f942b50 · cocos/cocos-engine · GitHub
and copied the code from downloadFile method in my function.

This is also not working on native platforms.

So what should i do to fix this?

The native version is here, please see jsb-adapter/jsb-loader.js at v2.4.10 · cocos-creator-packages/jsb-adapter · GitHub

Maybe this is a bug. Because when i do this:

cc.assetManager.downloader.register('.json', (url, options, onComplete) => {
	// @ts-ignore
	cc.assetManager.downloader.downloadFile(url, options, null, (err, data) => {
		console.log(url, err);
	});
});

It also fails with the same error:
nil host used in call to allowsSpecificHTTPSCertificateForHost

As i understand maybe jsb-loader.js does not override cc.assetManager.downloader.downloadFile function.

Is there a way to register downloading only for remote files? Not for local

It tries to load a file by local url:
/Users/zack/Documents/GitHub/merge/library/imports//10/10d36495-a5b6-4e84-8c7b-e84e567810a7.json

Hello, this error should be caused by this: