File tree Expand file tree Collapse file tree 4 files changed +11
-9
lines changed
Expand file tree Collapse file tree 4 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ export function getResult() {
1111 new Fields ( [
1212 [ 'User-agent' , encoder . encode ( 'WASI-HTTP/0.0.1' ) ] ,
1313 [ 'Content-type' , encoder . encode ( 'application/json' ) ] ,
14- ] )
14+ ] ) ,
1515 ) ;
1616
1717 req . setScheme ( { tag : 'HTTPS' } ) ;
@@ -27,13 +27,14 @@ export function getResult() {
2727 const responseHeaders = incomingResponse . headers ( ) . entries ( ) ;
2828
2929 const headers = Object . fromEntries (
30- responseHeaders . map ( ( [ k , v ] ) => [ k , decoder . decode ( v ) ] )
30+ responseHeaders . map ( ( [ k , v ] ) => [ k , decoder . decode ( v ) ] ) ,
3131 ) ;
3232
3333 let responseBody ;
34- const incomingBody = incomingResponse . consume ( ) ;
34+
35+ const incomingBody = incomingResponse . consume ( ) . val ;
3536 {
36- const bodyStream = incomingBody . stream ( ) ;
37+ const bodyStream = incomingBody . stream ( ) . val ;
3738 // const bodyStreamPollable = bodyStream.subscribe();
3839 const buf = bodyStream . blockingRead ( 500n ) ;
3940 // TODO: actual streaming
Original file line number Diff line number Diff line change 99export const incomingHandler = {
1010 handle ( incomingRequest , responseOutparam ) {
1111 const outgoingResponse = new OutgoingResponse ( new Fields ( ) ) ;
12- let outgoingBody = outgoingResponse . body ( ) ;
12+ let outgoingBody = outgoingResponse . body ( ) . val ;
1313 {
14- let outputStream = outgoingBody . write ( ) ;
14+ let outputStream = outgoingBody . write ( ) . val ;
1515 outputStream . blockingWriteAndFlush (
1616 new Uint8Array ( new TextEncoder ( ) . encode ( 'Hello world!' ) ) ,
1717 ) ;
Original file line number Diff line number Diff line change @@ -131,8 +131,8 @@ interface variants {
131131 is-clone-arg : func (a : is-clone );
132132 is-clone-return : func () -> is-clone ;
133133
134- return-named-option : func () -> ( a : option <u8 >) ;
135- return-named-result : func () -> ( a : result <u8 , my-errno >) ;
134+ return-named-option : func () -> option <u8 >;
135+ return-named-result : func () -> result <u8 , my-errno >;
136136}
137137
138138world my-world {
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ suite('Builtins', () => {
3636 `
3737 package local:runworld;
3838 world runworld {
39- export run: func() -> () ;
39+ export run: func();
4040 }
4141 ` ,
4242 {
@@ -271,6 +271,7 @@ suite('WASI', () => {
271271 export const run = {
272272 run () {
273273 result = \`NOW: \${now().seconds}, RANDOM: \${getRandomBytes(2n)}\`;
274+ return { tag: 'ok' };
274275 }
275276 };
276277
You can’t perform that action at this time.
0 commit comments