fastn-stack / fastn

🚧 (Alpha stage software) fastn - better way to build websites 🚧
https://fastn.com
GNU Affero General Public License v3.0
463 stars 36 forks source link

fix: Unexpected request route in wasm when the endpoint and handler name have the same prefix #1910

Closed siddhantk232 closed 1 month ago

siddhantk232 commented 1 month ago

For the following FASTN.ftd:

-- import: fastn

-- fastn.package: www.test.com

-- fastn.url-mappings:

/sub/* -> wasm+proxy://subscription.wasm/*

The request coming at /sub/subscribe/ would be send to the wasm with route as /scribe/. This happens because the mountpoint (/sub/) is repeatedly stripped from the request url.

This is fixed. We now only remove the mountpoint once from the request url.

The integration test provided with this PR run successfully on my machine. It requires some more work to run these in the CI (we have to fix old integration tests that is commented out first) which will be addressed in a separate PR.