feat: expose request header configuration

This commit is contained in:
a.tolmachev
2026-03-26 00:25:52 +03:00
parent bc5b55d0ab
commit 8c5d585b7f
5 changed files with 119 additions and 10 deletions
@@ -40,6 +40,25 @@ function describeTarget(target: OperationTarget) {
}
}
function readObjectRecord(value: unknown) {
if (value === null || typeof value !== "object" || Array.isArray(value)) {
return {};
}
return value as Record<string, unknown>;
}
function readExecutionHeaders(value: unknown) {
const config = readObjectRecord(value);
const headers = config.headers;
if (headers === null || typeof headers !== "object" || Array.isArray(headers)) {
return {};
}
return headers as Record<string, unknown>;
}
function draftSubtitle(target: OperationTarget) {
switch (target.kind) {
case "rest":
@@ -147,6 +166,16 @@ export function OperationDetailPage() {
<h3>Execution config</h3>
<pre>{JSON.stringify(snapshot.execution_config, null, 2)}</pre>
</div>
<div className="result-panel">
<h3>Transport headers</h3>
<pre>{JSON.stringify(readExecutionHeaders(snapshot.execution_config), null, 2)}</pre>
</div>
{snapshot.target.kind === "rest" ? (
<div className="result-panel">
<h3>REST static headers</h3>
<pre>{JSON.stringify(snapshot.target.static_headers ?? {}, null, 2)}</pre>
</div>
) : null}
</div>
</PageSection>
) : null}