mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
feature(client) view: unknown file type: method: GET -> HEAD: speed up
This commit is contained in:
parent
5e545c87b3
commit
60607184d4
3 changed files with 10 additions and 3 deletions
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue