gun-ipfs: application/json content-type guessing implemented; plus a relevant test

merge-requests/9/merge
Michał 'rysiek' Woźniak 2021-09-08 07:33:55 +00:00
rodzic ebba7e26d9
commit a9368d4394
2 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -107,6 +107,12 @@ describe("plugin: gun-ipfs", () => {
expect(self.log).toHaveBeenCalledWith('gun-ipfs', " +-- guessed contentType : text/javascript")
self.log.mockClear()
try {
await self.LibResilientPlugins[0].fetch(self.location.origin + '/test.json')
} catch(e) {}
expect(self.log).toHaveBeenCalledWith('gun-ipfs', " +-- guessed contentType : application/json")
self.log.mockClear()
try {
await self.LibResilientPlugins[0].fetch(self.location.origin + '/test.svg')
} catch(e) {}

Wyświetl plik

@ -201,6 +201,9 @@ if (typeof window === 'undefined') {
case 'js':
contentType = 'text/javascript';
break;
case 'json':
contentType = 'application/json';
break;
case 'svg':
contentType = 'image/svg+xml';
break;