Show the whole IP lookup answer, @meta included, on the home page (closes #201)
check / check (push) Canceled after 0s

The home page's IP lookup card showed only the answer's `data` part, or
only the message of an error answer. It now shows the whole answer,
`@meta` included, as the IP information API card does.

The server already added `@meta` to every JSON answer. A new table test
requests every JSON route and checks `@meta` and its fields. It covers
successes, the errors the handlers write, the router's 404 and 405, and
the 500 and 504 the middleware writes.

Model: opus-5-5
This commit is contained in:
2026-10-27 19:28:32 +00:00
parent e8d04f1304
commit bfa4da3dba
4 changed files with 123 additions and 13 deletions
+5 -11
View File
@@ -714,7 +714,8 @@
});
});
// IP lookup
// IP lookup: show the whole JSON answer, its @meta and an error answer
// included, as the IP information API card does.
document.getElementById('ip-form').addEventListener('submit', function(e) {
e.preventDefault();
const ip = document.getElementById('ip-input').value.trim();
@@ -730,18 +731,11 @@
fetch('/ip/' + encodeURIComponent(ip))
.then(response => response.json())
.then(response => {
contentEl.classList.remove('loading');
if (response.status === 'error') {
contentEl.className = 'error';
contentEl.textContent = 'Error: ' + response.error.msg;
} else {
contentEl.className = '';
contentEl.textContent = JSON.stringify(response.data, null, 2);
}
.then(answer => {
contentEl.className = '';
contentEl.textContent = JSON.stringify(answer, null, 2);
})
.catch(error => {
contentEl.classList.remove('loading');
contentEl.className = 'error';
contentEl.textContent = 'Error: ' + error.message;
});