-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: reenable ComponentizeJS test cases (#283)
- Loading branch information
1 parent
7db3985
commit 1307064
Showing
4 changed files
with
14 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { handle } from 'wasi:http/[email protected]05'; | ||
import { handle } from 'wasi:http/[email protected]10'; | ||
import { | ||
Fields, | ||
OutgoingRequest, | ||
OutgoingBody, | ||
} from 'wasi:http/[email protected]05'; | ||
} from 'wasi:http/[email protected]10'; | ||
|
||
const sendRequest = ( | ||
method, | ||
|
@@ -17,19 +17,19 @@ const sendRequest = ( | |
{ | ||
let encoder = new TextEncoder(); | ||
|
||
const request = new OutgoingRequest( | ||
method, | ||
pathWithQuery, | ||
scheme, | ||
authority, | ||
const req = new OutgoingRequest( | ||
new Fields([ | ||
['User-agent', encoder.encode('WASI-HTTP/0.0.1')], | ||
['Content-type', encoder.encode('application/json')], | ||
]) | ||
); | ||
req.setScheme(scheme); | ||
req.setMethod(method); | ||
req.setPathWithQuery(pathWithQuery); | ||
req.setAuthority(authority); | ||
|
||
if (body) { | ||
const outgoingBody = request.write(); | ||
const outgoingBody = req.body(); | ||
{ | ||
const bodyStream = outgoingBody.write(); | ||
bodyStream.blockingWriteAndFlush(encoder.encode(body)); | ||
|
@@ -39,7 +39,8 @@ const sendRequest = ( | |
OutgoingBody.finish(outgoingBody); | ||
} | ||
|
||
const futureIncomingResponse = handle(request); | ||
const futureIncomingResponse = handle(req); | ||
futureIncomingResponse.subscribe().block(); | ||
incomingResponse = futureIncomingResponse.get().val.val; | ||
} | ||
|
||
|
@@ -53,10 +54,8 @@ const sendRequest = ( | |
const incomingBody = incomingResponse.consume(); | ||
{ | ||
const bodyStream = incomingBody.stream(); | ||
// const bodyStreamPollable = bodyStream.subscribe(); | ||
bodyStream.subscribe().block(); | ||
const buf = bodyStream.read(50n); | ||
// TODO: actual streaming | ||
// TODO: explicit drops | ||
responseBody = buf.length > 0 ? new TextDecoder().decode(buf) : undefined; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters