uNetworking / uWebSockets.js

μWebSockets for Node.js back-ends :metal:
Apache License 2.0
7.95k stars 570 forks source link

Update getParameter example to use index instead of name #1056

Closed mikeseese closed 4 months ago

mikeseese commented 4 months ago

This PR updates the Benchmarker.js to use the most recent signature for HTTPRequest::getParameter, which accepts the index of the parameter instead of the name. The Router.js example already has the appropriate change, but this example is outdated.

uNetworkingAB commented 4 months ago

It's the opposite - getParameter(name) is brand new, getParameter(index) is old as rock. But the whole file was taken from here https://github.com/SaltyAom/bun-http-framework-benchmark

mikeseese commented 4 months ago

Ah I see; how would you like to proceed as this library doesn't use the same implementation as Bun's (and there's inconsistency between this example and Router.js)? The failing tests seem to be unrelated to this change (primarily compiler errors in Http3Context.h).

uNetworkingAB commented 4 months ago

I'm confused but I see the problem.

The JS wrapper does not expose the new getParameter(name) only the old getParameter(integer). The Benchmarker.js still happens to work because the integer value of "id" happens to be 0 as it fails to be an integer so it still gets the correct parameter.

What Bun has to do with this, I have no idea. The issue is that uWS.js needs to wrap the new overload that takes string.