Skip to content

Commit 042d264

Browse files
committed
remove dead writeResponseBody function and its tests
1 parent 6980508 commit 042d264

File tree

2 files changed

+0
-75
lines changed

2 files changed

+0
-75
lines changed

src/commands/api.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -863,22 +863,6 @@ export function writeResponseHeaders(
863863
stdout.write("\n");
864864
}
865865

866-
/**
867-
* Write response body to stdout
868-
* @internal Exported for testing
869-
*/
870-
export function writeResponseBody(stdout: Writer, body: unknown): void {
871-
if (body === null || body === undefined) {
872-
return;
873-
}
874-
875-
if (typeof body === "object") {
876-
stdout.write(`${JSON.stringify(body, null, 2)}\n`);
877-
} else {
878-
stdout.write(`${String(body)}\n`);
879-
}
880-
}
881-
882866
/**
883867
* Write verbose request output (curl-style format)
884868
* @internal Exported for testing

test/commands/api.test.ts

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
resolveEffectiveHeaders,
2929
resolveRequestUrl,
3030
setNestedValue,
31-
writeResponseBody,
3231
writeResponseHeaders,
3332
writeVerboseRequest,
3433
writeVerboseResponse,
@@ -913,64 +912,6 @@ describe("writeResponseHeaders", () => {
913912
});
914913
});
915914

916-
describe("writeResponseBody", () => {
917-
test("writes JSON object with formatting", () => {
918-
const writer = createMockWriter();
919-
920-
writeResponseBody(writer, { key: "value", num: 42 });
921-
922-
expect(writer.output).toBe('{\n "key": "value",\n "num": 42\n}\n');
923-
});
924-
925-
test("writes JSON array with formatting", () => {
926-
const writer = createMockWriter();
927-
928-
writeResponseBody(writer, [1, 2, 3]);
929-
930-
expect(writer.output).toBe("[\n 1,\n 2,\n 3\n]\n");
931-
});
932-
933-
test("writes string directly", () => {
934-
const writer = createMockWriter();
935-
936-
writeResponseBody(writer, "plain text response");
937-
938-
expect(writer.output).toBe("plain text response\n");
939-
});
940-
941-
test("writes number as string", () => {
942-
const writer = createMockWriter();
943-
944-
writeResponseBody(writer, 42);
945-
946-
expect(writer.output).toBe("42\n");
947-
});
948-
949-
test("writes boolean as string", () => {
950-
const writer = createMockWriter();
951-
952-
writeResponseBody(writer, true);
953-
954-
expect(writer.output).toBe("true\n");
955-
});
956-
957-
test("does not write null", () => {
958-
const writer = createMockWriter();
959-
960-
writeResponseBody(writer, null);
961-
962-
expect(writer.output).toBe("");
963-
});
964-
965-
test("does not write undefined", () => {
966-
const writer = createMockWriter();
967-
968-
writeResponseBody(writer, undefined);
969-
970-
expect(writer.output).toBe("");
971-
});
972-
});
973-
974915
describe("writeVerboseRequest", () => {
975916
test("writes method and endpoint", () => {
976917
const writer = createMockWriter();

0 commit comments

Comments
 (0)