MCPcopy Index your code
hub / github.com/oakserver/oak / getBody

Method getBody

http_server_node.ts:94–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

92 }
93
94 getBody(): ReadableStream<Uint8ArrayArrayBuffer> | null {
95 let body: ReadableStream<Uint8ArrayArrayBuffer> | null;
96 if (this.method === "GET" || this.method === "HEAD") {
97 body = null;
98 } else {
99 body = new ReadableStream<Uint8ArrayArrayBuffer>({
100 start: (controller) => {
101 this.#request.on("data", (chunk) => {
102 controller.enqueue(chunk as Uint8ArrayArrayBuffer);
103 });
104 this.#request.on("error", (err: Error) => {
105 controller.error(err);
106 });
107 this.#request.on("end", () => {
108 controller.close();
109 });
110 },
111 });
112 }
113 return body;
114 }
115
116 async respond(response: Response) {
117 if (this.#responded) {

Callers

nothing calls this directly

Calls 2

errorMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected