Debug-log every API request and response
check / check (push) Has been cancelled

Add debugFetch wrapper in log.js that logs method, URL, and body on
request, and status code on response. Replace all fetch() calls
across balances, transactions, tokens, background RPC proxy, and
settings validation with debugFetch.
This commit is contained in:
sneak committed 2026-02-26 15:40:09 +07:00
1 parent 47e690f466
commit d24c10ca9c
6 files changed
+24 -11

No files matched your search

+3 -3
View File
@@ -1,7 +1,7 @@
const { $, showView, showFlash } = require("./helpers");
const { state, saveState } = require("../../shared/state");
const { ETHEREUM_MAINNET_CHAIN_ID } = require("../../shared/constants");
const { log } = require("../../shared/log");
const { log, debugFetch } = require("../../shared/log");
const runtime =
typeof browser !== "undefined" ? browser.runtime : chrome.runtime;
@@ -56,7 +56,7 @@ function init(ctx) {
}
showFlash("Testing endpoint...");
try {
const resp = await fetch(url, {
const resp = await debugFetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
@@ -98,7 +98,7 @@ function init(ctx) {
}
showFlash("Testing endpoint...");
try {
const resp = await fetch(url + "/stats");
const resp = await debugFetch(url + "/stats");
if (!resp.ok) {
showFlash("Endpoint returned HTTP " + resp.status + ".");
return;