second-state / wasmedge-quickjs

A high-performance, secure, extensible, and OCI-complaint JavaScript runtime for WasmEdge.
Apache License 2.0
477 stars 59 forks source link

Get should be GET #127

Open lastmjs opened 7 months ago

lastmjs commented 7 months ago

I've been integrating Express in our environment and using wasmedge-quickjs. This enum is problematic: https://github.com/second-state/wasmedge-quickjs/blob/main/src/internal_module/httpx/core/mod.rs#L12

It seems that when this enum is turned into a JsValue that the properties are converted into strings as they are, so Get remains Get. This breaks the Express.js serve static middleware, as (IIRC) there is a conditional in there that looks at the method property of the request and compares it to GET. But unfortunately because of this enum the property is Get.

I believe that the request method should always have uppercase methods when converting from Rust to JS, at least that is how I have solved the problem in my work of wasmedge-quickjs.