bytecodealliance / ComponentizeJS

JS -> WebAssembly Component
Apache License 2.0
241 stars 32 forks source link

allow using fetchEvent for wasi:http/incoming-handler@0.2.0 optionally #122

Closed karthik2804 closed 4 months ago

karthik2804 commented 4 months ago

This PR adds the ability to use the fetchEvent from StarlingMonkey to handle incoming HTTP requests. This needs the http feature to be enabled explicitly.

karthik2804 commented 4 months ago

I tested this only with the incomingHandler annotation but the above is a good catch. Let me go do some more testing/digging and report back.

guybedford commented 4 months ago

It might be that name is just the interface name and so that the check should be using name_world_key against the interface world key for the full wasi:incoming-handler@2.0.0 case.

guybedford commented 4 months ago

Ahh, name is shadowing the outer name, so it should be renamed to Some(iface_name) = I think.

karthik2804 commented 4 months ago

To confirm my understanding the allowed exports are incomingHandler and "wasi:http/incoming-handler@0.2.0" correct? or is the explicit notation supposed to be wasiHttpIncomingHandler020 ?

guybedford commented 4 months ago

Yes exactly, so checking iface_name.toCamelCase() and name which are separate originating values.

karthik2804 commented 4 months ago

I believe we are already doing both the checks on line 388 (fully qualified name) and line 392 (sugared name) unless I am missing something but will rename it to iface_name

edit: I may have misunderstood the original comment but have renamed the variable.

karthik2804 commented 4 months ago

@guybedford let me know if there is anything else to address for this PR.

karthik2804 commented 4 months ago

@guybedford would it be possible to get a release with this PR? Thanks!

guybedford commented 4 months ago

Sure, I've published a 0.10.1.