diff --git a/client/modules/view/types.js b/client/modules/view/types.js index dd7888bb..c4cf5ce6 100644 --- a/client/modules/view/types.js +++ b/client/modules/view/types.js @@ -63,7 +63,9 @@ function isVideo(name) { module.exports._detectType = detectType; async function detectType(path) { - const {headers} = await fetch(path); + const {headers} = await fetch(path, { + method: 'HEAD', + }); for (const [name, value] of headers) { if (name === 'content-type') diff --git a/client/modules/view/types.spec.js b/client/modules/view/types.spec.js index d0e486f5..8df0c9da 100644 --- a/client/modules/view/types.spec.js +++ b/client/modules/view/types.spec.js @@ -27,8 +27,13 @@ test('cloudcmd: client: view: types: detectType', async (t) => { await _detectType('/hello'); global.fetch = originalFetch; + const expected = [ + '/hello', { + method: 'HEAD', + } + ]; - t.calledWith(fetch, ['/hello']); + t.calledWith(fetch, expected); t.end(); }); diff --git a/package.json b/package.json index 26814456..0e147979 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "putout": "^14.0.0", "redzip": "^1.6.4", "rendy": "^3.0.0", - "restafary": "^9.5.0", + "restafary": "^9.6.0", "restbox": "^3.0.0", "shortdate": "^2.0.0", "simport": "^1.0.1",