Skip to content

Commit fdbfe3a

Browse files
committed
fix(gateway): allow no-content responses in TUI
1 parent 418fe96 commit fdbfe3a

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

src/handlers/gateway/invoke/invoke.screen.test.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,27 @@ describe("Gateway invoke JSON console", () => {
635635
expect(screen.lastFrame()).toContain("failed · 7 bytes");
636636
});
637637

638+
test.each([204, 205])(
639+
"accepts HTTP %s without a content type or response body",
640+
async (statusCode) => {
641+
const core = new TestCoreClient();
642+
core.gateway.setGetResponse(gatewayDetail()).setInvokeResponse({
643+
statusCode,
644+
contentType: "",
645+
body: responseBody(),
646+
});
647+
const screen = renderScreen(CONSOLE_PATH, { core });
648+
649+
await waitForText(screen.lastFrame, "Ready");
650+
await screen.write("{}");
651+
await screen.press("return");
652+
653+
await waitForText(screen.lastFrame, "complete · 0 bytes");
654+
expect(screen.lastFrame()).toContain(`Response · ${statusCode} · -`);
655+
expect(screen.lastFrame()).not.toContain("Binary or unknown responses");
656+
},
657+
);
658+
638659
test("rejects binary console responses without consuming their bodies", async () => {
639660
let iterations = 0;
640661
const core = new TestCoreClient();

src/handlers/gateway/invoke/screen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ function GatewayInvokeConsole({ ctx, core, gatewayId, initialContext }: GatewayI
256256
state: "streaming",
257257
});
258258
const kind = classifyStreamingResponse(response.contentType);
259-
if (kind === "binary") {
259+
if (response.statusCode !== 204 && response.statusCode !== 205 && kind === "binary") {
260260
controller.abort();
261261
updateExchange({
262262
response: "Binary or unknown responses require headless invoke with --output-file.",

0 commit comments

Comments
 (0)