MCPcopy Create free account
hub / github.com/bytecodealliance/ComponentizeJS / handle

Function handle

test/cases/http-server/source.js:10–26  ·  view source on GitHub ↗
(incomingRequest, responseOutparam)

Source from the content-addressed store, hash-verified

8
9export const incomingHandler = {
10 handle(incomingRequest, responseOutparam) {
11 const outgoingResponse = new OutgoingResponse(new Fields());
12 let outgoingBody = outgoingResponse.body();
13 {
14 let outputStream = outgoingBody.write();
15 outputStream.blockingWriteAndFlush(
16 new Uint8Array(new TextEncoder().encode('Hello world!')),
17 );
18 outputStream[Symbol.dispose]();
19 }
20 outgoingResponse.setStatusCode(200);
21 OutgoingBody.finish(outgoingBody, undefined);
22 ResponseOutparam.set(responseOutparam, {
23 tag: 'ok',
24 val: outgoingResponse,
25 });
26 },
27};

Callers 1

getResultFunction · 0.85

Calls 1

setMethod · 0.80

Tested by

no test coverage detected