PHP WebShell

Текущая директория: /opt/BitGoJS/node_modules/@cosmjs/tendermint-rpc/build/rpcclients

Просмотр файла: http.js

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.http = void 0;
const axios_1 = __importDefault(require("axios"));
function filterBadStatus(res) {
    if (res.status >= 400) {
        throw new Error(`Bad status on response: ${res.status}`);
    }
    return res;
}
/**
 * Helper to work around missing CORS support in Tendermint (https://github.com/tendermint/tendermint/pull/2800)
 *
 * For some reason, fetch does not complain about missing server-side CORS support.
 */
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
async function http(method, url, headers, request) {
    if (typeof fetch !== "undefined") {
        const settings = {
            method: method,
            body: request ? JSON.stringify(request) : undefined,
            headers: {
                // eslint-disable-next-line @typescript-eslint/naming-convention
                "Content-Type": "application/json",
                ...headers,
            },
        };
        return fetch(url, settings)
            .then(filterBadStatus)
            .then((res) => res.json());
    }
    else {
        return axios_1.default
            .request({ url: url, method: method, data: request, headers: headers })
            .then((res) => res.data);
    }
}
exports.http = http;
//# sourceMappingURL=http.js.map

Выполнить команду


Для локальной разработки. Не используйте в интернете!