@aimeloic/monkey-tester 3.0.5 โ 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/htmlTemplate.js +12 -12
- package/package.json +1 -1
package/htmlTemplate.js
CHANGED
|
@@ -8,7 +8,7 @@ function getHtmlTemplate(endpoints) {
|
|
|
8
8
|
<head>
|
|
9
9
|
<meta charset="UTF-8">
|
|
10
10
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
11
|
-
<title>Monkey Tester
|
|
11
|
+
<title>Monkey Tester — API Sandbox</title>
|
|
12
12
|
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500&display=swap" rel="stylesheet">
|
|
13
13
|
<style>
|
|
14
14
|
:root {
|
|
@@ -153,7 +153,7 @@ function getHtmlTemplate(endpoints) {
|
|
|
153
153
|
<div id="__monkey_data__" data-payload="${safeJsonString}" style="display:none;"></div>
|
|
154
154
|
|
|
155
155
|
<header>
|
|
156
|
-
<div class="logo"
|
|
156
|
+
<div class="logo">🐒 Monkey Tester <span>API Sandbox</span></div>
|
|
157
157
|
<div class="header-right">
|
|
158
158
|
<div class="base-url-wrap">
|
|
159
159
|
<label>TARGET HOST</label>
|
|
@@ -174,7 +174,7 @@ function getHtmlTemplate(endpoints) {
|
|
|
174
174
|
<div class="response-panel">
|
|
175
175
|
<div class="response-header">
|
|
176
176
|
<span class="response-header-title">Response</span>
|
|
177
|
-
<span id="status-badge" class="status-badge status-idle"
|
|
177
|
+
<span id="status-badge" class="status-badge status-idle">—</span>
|
|
178
178
|
</div>
|
|
179
179
|
<div class="response-body empty" id="response-body">Execute a request to see the response</div>
|
|
180
180
|
</div>
|
|
@@ -265,7 +265,7 @@ function getHtmlTemplate(endpoints) {
|
|
|
265
265
|
|
|
266
266
|
function showEmptyState() {
|
|
267
267
|
document.getElementById('main-panel').innerHTML =
|
|
268
|
-
'<div class="empty-state"><div class="monkey"
|
|
268
|
+
'<div class="empty-state"><div class="monkey">🐒</div>' +
|
|
269
269
|
'<h2>No endpoints found</h2>' +
|
|
270
270
|
'<p>Make sure <code>app.use(endtesterExpress())</code> is added after your routes.</p></div>';
|
|
271
271
|
}
|
|
@@ -278,7 +278,7 @@ function getHtmlTemplate(endpoints) {
|
|
|
278
278
|
for (var i = 0; i < ep.params.length; i++) {
|
|
279
279
|
var p = ep.params[i];
|
|
280
280
|
var val = (document.getElementById('param-' + p.name) || {}).value || '';
|
|
281
|
-
if (!val.trim()) { showToast('
|
|
281
|
+
if (!val.trim()) { showToast('[!] Path param "' + p.label + '" is required'); return; }
|
|
282
282
|
path = path.replace(':' + p.name, encodeURIComponent(val.trim()));
|
|
283
283
|
}
|
|
284
284
|
}
|
|
@@ -293,18 +293,18 @@ function getHtmlTemplate(endpoints) {
|
|
|
293
293
|
if (['POST', 'PUT', 'PATCH'].includes(ep.method) && ep.fields && ep.fields.length) {
|
|
294
294
|
var payload = {};
|
|
295
295
|
var hasData = false;
|
|
296
|
-
|
|
296
|
+
|
|
297
297
|
ep.fields.forEach(function(f) {
|
|
298
298
|
var el = document.getElementById('field-' + f.name);
|
|
299
299
|
if (!el) return;
|
|
300
300
|
var v = el.value.trim();
|
|
301
301
|
if (v === '') return;
|
|
302
|
-
|
|
302
|
+
|
|
303
303
|
if (f.type === 'number') v = Number(v);
|
|
304
304
|
payload[f.name] = v;
|
|
305
305
|
hasData = true;
|
|
306
306
|
});
|
|
307
|
-
|
|
307
|
+
|
|
308
308
|
if (hasData) body = JSON.stringify(payload);
|
|
309
309
|
}
|
|
310
310
|
|
|
@@ -329,14 +329,14 @@ function getHtmlTemplate(endpoints) {
|
|
|
329
329
|
|
|
330
330
|
if (state === 'loading') {
|
|
331
331
|
badge.className = 'status-badge status-idle';
|
|
332
|
-
badge.textContent = '
|
|
332
|
+
badge.textContent = '...';
|
|
333
333
|
body.className = 'response-body empty';
|
|
334
|
-
body.textContent = 'Sending
|
|
334
|
+
body.textContent = 'Sending...';
|
|
335
335
|
return;
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
badge.className = 'status-badge ' + (state === 'ok' ? 'status-ok' : 'status-err');
|
|
339
|
-
badge.textContent = status + '
|
|
339
|
+
badge.textContent = status + ' \u00b7 ' + ms + 'ms';
|
|
340
340
|
body.className = 'response-body';
|
|
341
341
|
var str = typeof data === 'string' ? data : JSON.stringify(data, null, 2);
|
|
342
342
|
body.innerHTML = '<pre class="json-render-block">' + highlight(str) + '</pre>';
|
|
@@ -344,7 +344,7 @@ function getHtmlTemplate(endpoints) {
|
|
|
344
344
|
|
|
345
345
|
function clearResponse() {
|
|
346
346
|
document.getElementById('status-badge').className = 'status-badge status-idle';
|
|
347
|
-
document.getElementById('status-badge').textContent = '
|
|
347
|
+
document.getElementById('status-badge').textContent = '\u2014';
|
|
348
348
|
var body = document.getElementById('response-body');
|
|
349
349
|
body.className = 'response-body empty';
|
|
350
350
|
body.textContent = 'Execute a request to see the response';
|