@t0.labs/daxta 0.3.5 → 0.3.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/assets/viewer.html +16 -10
- package/package.json +1 -1
package/assets/viewer.html
CHANGED
|
@@ -1358,15 +1358,26 @@
|
|
|
1358
1358
|
return currentBaseUrl() + path + (qs ? "?" + qs : "");
|
|
1359
1359
|
};
|
|
1360
1360
|
|
|
1361
|
-
/**
|
|
1361
|
+
/**
|
|
1362
|
+
* Use only headers that were on this recorded request.
|
|
1363
|
+
* Empty headers (e.g. 401 missing-auth cases) must stay empty — never inject env auth.
|
|
1364
|
+
* When headers exist, env can override values for the same keys (live tokens).
|
|
1365
|
+
*/
|
|
1362
1366
|
const requestHeadersForScenario = (scenario) => {
|
|
1363
1367
|
const recorded = { ...(scenario.headers || {}) };
|
|
1364
1368
|
const vars = varMap();
|
|
1369
|
+
const envHeaders = resolvedHeaders();
|
|
1370
|
+
const envByLower = {};
|
|
1371
|
+
for (const [name, value] of Object.entries(envHeaders)) {
|
|
1372
|
+
envByLower[String(name).toLowerCase()] = value;
|
|
1373
|
+
}
|
|
1374
|
+
const out = {};
|
|
1365
1375
|
for (const [name, value] of Object.entries(recorded)) {
|
|
1366
|
-
|
|
1376
|
+
const fromEnv = envByLower[String(name).toLowerCase()];
|
|
1377
|
+
const raw = fromEnv != null && String(fromEnv).trim() !== "" ? fromEnv : value;
|
|
1378
|
+
out[name] = String(interpolate(raw, vars));
|
|
1367
1379
|
}
|
|
1368
|
-
|
|
1369
|
-
return resolvedHeaders();
|
|
1380
|
+
return out;
|
|
1370
1381
|
};
|
|
1371
1382
|
|
|
1372
1383
|
const toCurl = (item, scenario) => {
|
|
@@ -1685,7 +1696,6 @@
|
|
|
1685
1696
|
const scenario = item.scenarios[scenarioIndex] || { status: 0, pathParams: {}, query: {}, headers: {}, name: "" };
|
|
1686
1697
|
const fields = item.docs.fields || [];
|
|
1687
1698
|
ensureRequiredHeaderGroup(item.op);
|
|
1688
|
-
const injectedHeaders = resolvedHeaders();
|
|
1689
1699
|
const recordedHeaders = scenario.headers || {};
|
|
1690
1700
|
const recordedOk = scenario.status >= 200 && scenario.status < 300;
|
|
1691
1701
|
const statusText = STATUS[scenario.status] || item.op.responses?.[String(scenario.status)]?.description || "";
|
|
@@ -1699,13 +1709,9 @@
|
|
|
1699
1709
|
const displayEmpty = showingLive ? displayBody === undefined || displayBody === "" : emptyResponse;
|
|
1700
1710
|
const resCopyText = displayEmpty ? null : copyBodyText(displayBody);
|
|
1701
1711
|
const responseTitle = showingLive ? "Live response" : "Recorded response";
|
|
1702
|
-
// Request card shows the recorded scenario headers (match this example).
|
|
1703
|
-
// Send / cURL still use env header groups so secrets stay editable.
|
|
1704
1712
|
const headersHtml = Object.keys(recordedHeaders).length
|
|
1705
1713
|
? Object.entries(recordedHeaders).map(([name, value]) => kv(name, value)).join("")
|
|
1706
|
-
:
|
|
1707
|
-
? Object.entries(injectedHeaders).map(([name, value]) => kv(name, value)).join("")
|
|
1708
|
-
: `<div class="meta-empty">No headers recorded for this example</div>`;
|
|
1714
|
+
: `<div class="meta-empty">No headers on this recorded request</div>`;
|
|
1709
1715
|
const pathParamsHtml = Object.entries(scenario.pathParams || {})
|
|
1710
1716
|
.map(([name, value]) => kv(name, value))
|
|
1711
1717
|
.join("");
|