/
githubmirror
/
axios
Обзор
Документация
Войти
/
githubmirror
/
axios
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v1.x
scripts/axios-build-instance.js
28 строк
633 B
Azanda
fix: replace ternary side effect in script (#10931)
01 июн 2026, 18:47
Не верифицирован
01 июн 2026, 18:47
32e2515
Код
Авторство
О чём код?
import axios from '../index.js'; const { GITHUB_TOKEN } = process.env; if (GITHUB_TOKEN) { console.log(`[GITHUB_TOKEN OK]`); } else { console.warn(`[GITHUB_TOKEN is not defined]`); } const defaultTransform = axios.defaults.transformRequest; export default axios.create({ transformRequest: [ defaultTransform[0], function (data) { console.log( `[${this.method.toUpperCase()}] Request [${new URL(axios.getUri(this)).pathname}]` ); return data; }, ], baseURL: 'https://api.github.com/', headers: { ...(GITHUB_TOKEN ? { Authorization: `token ${GITHUB_TOKEN}` } : {}), }, });