/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/javascript/js-501-251-004/main.js
15 строк
594 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
fetch(url, { method: 'GET', // 'POST', 'PUT', … headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data), // для POST/PUT mode: 'cors', // 'same-origin', 'no-cors' credentials: 'same-origin', // 'include', 'omit' cache: 'default', // 'no-store', 'reload', 'force-cache', … redirect: 'follow', // 'manual', 'error' signal: ac.signal, // AbortSignal для отмены integrity: 'sha256-…' // Subresource Integrity }) .then(res => { if (!res.ok) throw new Error(`HTTP ${res.status}`); return res.json(); // .text(), .blob(), .arrayBuffer() });